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

Fix #3644: Handles empty hint in hint editor by showing a message and deleting it #3648

Merged
merged 5 commits into from
Jul 17, 2017

Conversation

kevintab95
Copy link
Member

Linking #3644.

@kevintab95 kevintab95 requested review from tjiang11 and seanlip July 16, 2017 05:27
@seanlip
Copy link
Member

seanlip commented Jul 16, 2017

Did you test this carefully? I poked around and ran into cases where it does not fully work -- e.g. if you clear hint 1 and then click on hint 2.

var currentActiveIndex = $scope.activeHintIndex;
if (currentActiveIndex && (
!stateHintsService.displayed[currentActiveIndex].hintText)) {
alertsService.addInfoMessage('Deleting empty hint!');
Copy link
Member

Choose a reason for hiding this comment

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

I think I'd drop the exclamation mark here, and follow the style of the other info messages -- deleting a hint is not that exciting :P

Copy link
Member Author

Choose a reason for hiding this comment

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

haha, sure! (and yes, that particular case doesn't work. I'll fix it.)

@codecov-io
Copy link

codecov-io commented Jul 16, 2017

Codecov Report

Merging #3648 into develop will decrease coverage by 0.01%.
The diff coverage is 0%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #3648      +/-   ##
===========================================
- Coverage    44.85%   44.83%   -0.02%     
===========================================
  Files          257      257              
  Lines        19881    19888       +7     
  Branches      3133     3135       +2     
===========================================
  Hits          8917     8917              
- Misses       10964    10971       +7
Impacted Files Coverage Δ
.../pages/exploration_editor/editor_tab/StateHints.js 1.49% <0%> (-0.18%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 45df731...3d5929c. Read the comment docs.

@@ -51,6 +51,13 @@ oppia.controller('StateHints', [
};

$scope.changeActiveHintIndex = function(newIndex) {
var currentActiveIndex = $scope.activeHintIndex;
if (Number.isInteger(currentActiveIndex) && (
Copy link
Member

Choose a reason for hiding this comment

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

Semantically, should this actually be something like currentActiveIndex !== null?

Copy link
Member Author

Choose a reason for hiding this comment

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

done.

@@ -51,6 +51,13 @@ oppia.controller('StateHints', [
};

$scope.changeActiveHintIndex = function(newIndex) {
var currentActiveIndex = $scope.activeHintIndex;
if (Number.isInteger(currentActiveIndex) && (
!stateHintsService.displayed[currentActiveIndex].hintText)) {
Copy link
Member

Choose a reason for hiding this comment

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

You can indent this by 2 more to distinguish it from the next line (which is the one that actually starts an inner scope).

Copy link
Member Author

Choose a reason for hiding this comment

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

done.

alertsService.addInfoMessage('Deleting empty hint.');
stateHintsService.displayed.splice(currentActiveIndex, 1);
stateHintsService.saveDisplayedValue();
}
// If the current hint is being clicked on again, close it.
Copy link
Member

Choose a reason for hiding this comment

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

sorry, small nit: indent this by 2.

Copy link
Member Author

Choose a reason for hiding this comment

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

I think I'll fix the "Hints" showing up in logged out view in this PR along with this.

Copy link
Member

Choose a reason for hiding this comment

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

OK, sounds good. Let me drop the lgtm for the time being while you do that, then :)

seanlip
seanlip previously approved these changes Jul 16, 2017
Copy link
Member

@seanlip seanlip left a comment

Choose a reason for hiding this comment

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

LGTM

@seanlip seanlip dismissed their stale review July 16, 2017 06:44

Waiting for other bug to be fixed.

Copy link
Contributor

@tjiang11 tjiang11 left a comment

Choose a reason for hiding this comment

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

Reviewing the deletion of empty hints: lgtm

@kevintab95
Copy link
Member Author

Fixed "Hints" text appearing when there are no hints in logged out view as well. PTAL. Thanks!

Copy link
Member

@seanlip seanlip left a comment

Choose a reason for hiding this comment

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

Thanks! LGTM from code perspective.

@seanlip seanlip merged commit b6eec3f into oppia:develop Jul 17, 2017
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.

4 participants