Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PC-168] Challenge tips disappear if challenge already complete #437

Merged

Conversation

lauraenria
Copy link
Contributor

This code will allow the challenge to go to the next one if it has been already complete

when a challenge has been already complete
go to the next one
$scope.hint = $scope.content.steps[step] ? $scope.content.steps[step].hint : null;
}
$scope.solution = $scope.getSolution();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Presumably we don't need to update the solution either if we've reached the end of the steps.

$scope.next = getNextChallenge();

setStep(0);
$scope.started = true;
$scope.animationClass = '';

$scope.$watch('step', function (step) {
if (step >= $scope.content.steps.length) {
//$scope.completed = true;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Delete this

if (step >= $scope.content.steps.length) {
//$scope.completed = true;
$scope.validate()
} else {
$scope.hint = $scope.content.steps[step] ? $scope.content.steps[step].hint : null;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indent

@@ -443,7 +448,6 @@ app.controller('ChallengeController', function ($scope, $routeParams, $window, $
xpMessage = xpGain ? ' You earned ' + $scope.xpGain + 'xp!' : '',
onlineMessage = successMsg,
offlineMessage = onlineMessage + xpMessage;

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why?

$scope.next = getNextChallenge();

setStep(0);
$scope.started = true;
$scope.animationClass = '';

$scope.$watch('step', function (step) {
if (step >= $scope.content.steps.length) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Presumably getting the validation to trigger on things other than key press didn't pan out?

@tombettany tombettany changed the title Pc 168/challenge tips disappear if challenge already complete [PC-168] Challenge tips disappear if challenge already complete Jun 4, 2019
Copy link
Member

@tombettany tombettany left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wait, now we are doing both? I thought that the two options were either:

  • Add if in the $watch on step to validate() if you are at the end
  • Remove the session.steps criterion from the if() statement in validate()
    The plan was definitely not to do both. Remove the former and make sure that it is working with these changes.

@lauraenria
Copy link
Contributor Author

Wait, now we are doing both? I thought that the two options were either:

  • Add if in the $watch on step to validate() if you are at the end
  • Remove the session.steps criterion from the if() statement in validate()
    The plan was definitely not to do both. Remove the former and make sure that it is working with these changes.

I agree with you, probably I when I checkout all the file to delete the console I didn't realise the format version had the previous solution. It now should be done.

@tombettany tombettany merged commit 3a6ddec into master Jun 11, 2019
@tombettany tombettany deleted the PC-168/ChallengeTips-disappear-if-challengeAlreadyComplete branch June 11, 2019 11:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants