Skip to content

Commit

Permalink
Prevent hints from being released after correct answer is submitted. (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
tjiang11 authored and seanlip committed Jan 21, 2018
1 parent b145937 commit 006b351
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -706,7 +706,7 @@ oppia.directive('conversationSkin', [
hasContinueButton: true
});
}
$scope.$broadcast(EVENT_NEW_CARD_AVAILABLE);
$rootScope.$broadcast(EVENT_NEW_CARD_AVAILABLE);
_nextFocusLabel = $scope.CONTINUE_BUTTON_FOCUS_LABEL;
FocusManagerService.setFocusIfOnDesktop(_nextFocusLabel);
scrollToBottom();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,12 @@ oppia.factory('HintsAndSolutionManagerService', [
'$timeout', '$rootScope', 'PlayerTranscriptService',
'DELAY_FOR_HINT_FEEDBACK_MSEC', 'HINT_REQUEST_STRING_I18N_IDS',
'WAIT_FOR_FIRST_HINT_MSEC', 'WAIT_FOR_SUBSEQUENT_HINTS_MSEC',
'EVENT_NEW_CARD_AVAILABLE',
function(
$timeout, $rootScope, PlayerTranscriptService,
DELAY_FOR_HINT_FEEDBACK_MSEC, HINT_REQUEST_STRING_I18N_IDS,
WAIT_FOR_FIRST_HINT_MSEC, WAIT_FOR_SUBSEQUENT_HINTS_MSEC) {
WAIT_FOR_FIRST_HINT_MSEC, WAIT_FOR_SUBSEQUENT_HINTS_MSEC,
EVENT_NEW_CARD_AVAILABLE) {
var timeout = null;
var ACCELERATED_HINT_WAIT_TIME_MSEC = 10000;
var WAIT_FOR_TOOLTIP_TO_BE_SHOWN_MSEC = 60000;
Expand All @@ -35,6 +37,7 @@ oppia.factory('HintsAndSolutionManagerService', [
var hintsForLatestCard = [];
var solutionForLatestCard = null;
var wrongAnswersSinceLastHintConsumed = 0;
var correctAnswerSubmitted = false;

// tooltipIsOpen is a flag which says that the tooltip is currently
// visible to the learner.
Expand All @@ -44,6 +47,11 @@ oppia.factory('HintsAndSolutionManagerService', [
var hintsDiscovered = false;
var tooltipTimeout = null;


$rootScope.$on(EVENT_NEW_CARD_AVAILABLE, function() {
correctAnswerSubmitted = true;
});

// This replaces any timeouts that are already queued.
var enqueueTimeout = function(func, timeToWaitMsec) {
if (timeout) {
Expand All @@ -58,10 +66,12 @@ oppia.factory('HintsAndSolutionManagerService', [
};

var releaseHint = function() {
numHintsReleased++;
if (!hintsDiscovered && !tooltipTimeout) {
tooltipTimeout = $timeout(
showTooltip, WAIT_FOR_TOOLTIP_TO_BE_SHOWN_MSEC);
if (!correctAnswerSubmitted) {
numHintsReleased++;
if (!hintsDiscovered && !tooltipTimeout) {
tooltipTimeout = $timeout(
showTooltip, WAIT_FOR_TOOLTIP_TO_BE_SHOWN_MSEC);
}
}
};
var releaseSolution = function() {
Expand Down Expand Up @@ -108,6 +118,7 @@ oppia.factory('HintsAndSolutionManagerService', [
hintsForLatestCard = newHints;
solutionForLatestCard = newSolution;
wrongAnswersSinceLastHintConsumed = 0;
correctAnswerSubmitted = false;
if (timeout) {
$timeout.cancel(timeout);
}
Expand Down

0 comments on commit 006b351

Please sign in to comment.