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

Implement editing of questions #5614

Merged
merged 46 commits into from
Dec 10, 2018
Merged

Implement editing of questions #5614

merged 46 commits into from
Dec 10, 2018

Conversation

tjiang11
Copy link
Contributor

@tjiang11 tjiang11 commented Sep 1, 2018

No description provided.

@codecov-io
Copy link

codecov-io commented Sep 1, 2018

Codecov Report

Merging #5614 into develop will decrease coverage by <.01%.
The diff coverage is 53.29%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #5614      +/-   ##
===========================================
- Coverage    45.48%   45.47%   -0.01%     
===========================================
  Files          517      518       +1     
  Lines        30372    30493     +121     
  Branches      4568     4576       +8     
===========================================
+ Hits         13814    13867      +53     
- Misses       16558    16626      +68
Impacted Files Coverage Δ
...v/head/pages/creator_dashboard/CreatorDashboard.js 18.66% <ø> (+0.06%) ⬆️
...s/interactions/LogicProof/directives/LogicProof.js 8.73% <0%> (ø) ⬆️
...es/topic_editor/questions/QuestionsTabDirective.js 0.52% <0%> (-0.13%) ⬇️
...d/pages/question_editor/QuestionEditorDirective.js 2.77% <0%> (-0.68%) ⬇️
.../dev/head/domain/question/QuestionUpdateService.js 100% <100%> (ø)
...ev/head/domain/editor/undo_redo/UndoRedoService.js 100% <100%> (ø) ⬆️
...es/state_editor/StateInteractionEditorDirective.js 33.72% <100%> (+0.39%) ⬆️
...main/question/EditableQuestionBackendApiService.js 74.41% <100%> (ø) ⬆️
...ead/domain/exploration/InteractionObjectFactory.js 75.92% <12.5%> (-11.04%) ⬇️
...plates/dev/head/domain/state/StateObjectFactory.js 73.33% <14.28%> (-17.98%) ⬇️
... and 7 more

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 d4a4df4...7a10a7b. Read the comment docs.

Copy link
Contributor

@aks681 aks681 left a comment

Choose a reason for hiding this comment

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

Did a quick pass and left some comments.


Returns:
list(QuestionSkillLinkModel). The list of question skill link
domain objects that are linked to the question ID or an empty list
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think the domain objects for QuestionSkillLink are being returned currently. Can you change the returned object to be a list of QuestionSkillLink domain objects instead of datastore objects?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

Copy link
Contributor

Choose a reason for hiding this comment

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

In that case, I think the docstring should also be changed to QuestionSkillLink, instead of QuestionSkillLinkModel?

Copy link
Contributor

Choose a reason for hiding this comment

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

Pending comment?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

@@ -25,7 +25,7 @@ oppia.directive('questionEditor', [
getQuestionId: '&questionId',
getMisconceptions: '&misconceptions',
canEditQuestion: '&',
questionStateData: '='
question: '='
Copy link
Contributor

Choose a reason for hiding this comment

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

If you are doing this, might as well remove questionId above as well, and use the question object itself?
Also, did you change all instances of this directive to use this? I think this is used in creator_dashboard as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done, can you check if the instance in the creator dashboard still functions properly? I can't seem to figure out how to test it. (I activated ENABLE_NEW_STRUCTURES and ENABLE_GENERALIZED_FEEDBACK_THREADS in constants.js but don't see anything)

@tjiang11
Copy link
Contributor Author

tjiang11 commented Sep 4, 2018

Hi @aks681 , can you do another pass?

Copy link
Contributor

@aks681 aks681 left a comment

Choose a reason for hiding this comment

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

Did a full pass. Mostly minor comments.

core/domain/question_services.py Show resolved Hide resolved

Returns:
list(QuestionSkillLinkModel). The list of question skill link
domain objects that are linked to the question ID or an empty list
Copy link
Contributor

Choose a reason for hiding this comment

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

In that case, I think the docstring should also be changed to QuestionSkillLink, instead of QuestionSkillLinkModel?

ID doesn't exist.
"""
return QuestionSkillLinkModel.query().filter(
cls.question_id == question_id).fetch()
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't cls.deleted == false be also checked?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

oppia.constant('CMD_UPDATE_QUESTION_PROPERTY', 'update_question_property');

oppia.factory('QuestionUpdateService', [
'QuestionObjectFactory',
Copy link
Contributor

Choose a reason for hiding this comment

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

I think 2 or 3 dependencies can be declared in a line?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

QUESTION_PROPERTY_LANGUAGE_CODE,
QUESTION_PROPERTY_QUESTION_STATE_DATA,
CMD_UPDATE_QUESTION_PROPERTY) {
var _changeCount = 0;
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't see this being incremented in this file, only reset seems to be there. Isn't this available from QuestionUndoRedoService?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah my bad, I forgot to remove those

EVENT_QUESTION_SUMMARIES_INITIALIZED,
QuestionUndoRedoService, UrlService,
UndoRedoService) {
$scope.QuestionUndoRedoService = QuestionUndoRedoService;
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this used in the HTML file? If not, no need to have it in $scope.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is used in the html file now

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok, but even then it only uses that single function. So, just surface that function to scope instead of the whole service.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@tjiang11
Copy link
Contributor Author

tjiang11 commented Sep 9, 2018

Hi @aks681 , can you do another pass?

@tjiang11
Copy link
Contributor Author

I updated this to adapt to the recent UI changes. PTAL!

@aks681 @seanlip

@aks681
Copy link
Contributor

aks681 commented Oct 31, 2018

@tjiang11 Is there anything extra to do to test the question editor? I enabled the flag in constants.js. Went to Questions tab in topic editor, created a question and then clicked on it again, which opened the question editor with that question's details already filled.
But here, when I changed values and clicked Ok, I got console errors and orange pop ups saying.
http://localhost:8181/question_editor_handler/data/8U19JTCTGeFG not found. Do you know why?

@tjiang11
Copy link
Contributor Author

tjiang11 commented Nov 4, 2018

Hi @aks681 , the issue should be fixed, PTAL!

@aks681
Copy link
Contributor

aks681 commented Nov 9, 2018

UI LGTM! @seanlip can you do one last code review? I think it might be good to go.

@@ -98,10 +98,56 @@ oppia.directive('stateInteractionEditor', [
interactionCustomizationArgs, false);
};

var _updateInteractionPreviewAndAnswerChoices = function() {
Copy link
Member

Choose a reason for hiding this comment

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

Could you reuse the logic in StateEditorService.getAnswerChoices()? Better than duplicating.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@seanlip
Copy link
Member

seanlip commented Nov 10, 2018

Just one last issue with code duplication (I think). Otherwise looks good, thanks!

@oppiabot
Copy link

oppiabot bot commented Nov 19, 2018

Hi @tjiang11. Due to recent changes in the "develop" branch, this PR now has a merge conflict. Please follow this link if you need help resolving the conflict, so that the PR can be merged. Thanks!

@oppiabot
Copy link

oppiabot bot commented Nov 29, 2018

Hi @tjiang11, I'm going to mark this PR as stale because it hasn't had any updates for 10 days. If no further activity occurs within 7 days, it will be automatically closed so that others can take up the issue.
If you are still working on this PR, please make a follow-up commit within 7 days (and submit it for review, if applicable). Please also let us know if you are stuck so we can help you!

@oppiabot oppiabot bot added the stale label Nov 29, 2018
…estion's interaction; Fix issue with not validating when no interaction is specified.
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.

Hi @tjiang11, I think you forgot to flip the flag back. Otherwise looks good, thanks!

@@ -464,7 +464,7 @@ var constants = {
"\\u001b", "\\u001c", "\\u001d", "\\u001e", "\\u001f"
],

"ENABLE_NEW_STRUCTURES": false,
"ENABLE_NEW_STRUCTURES": true,
Copy link
Member

Choose a reason for hiding this comment

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

This should be false, right?

Copy link
Contributor

@aks681 aks681 left a comment

Choose a reason for hiding this comment

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

Will merge as soon as the above comment is addressed.

Copy link
Contributor

@aks681 aks681 left a comment

Choose a reason for hiding this comment

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

Looks good, thanks!
Merging.

@aks681 aks681 merged commit 4d615cf into develop Dec 10, 2018
@aks681 aks681 deleted the edit-questions branch December 10, 2018 14:59
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.

5 participants