Skip to content

Commit

Permalink
JS tweaks and doc string updates from review.
Browse files Browse the repository at this point in the history
  • Loading branch information
rtibbles committed Nov 19, 2021
1 parent 4c2a32f commit fd2c869
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 14 deletions.
10 changes: 6 additions & 4 deletions kolibri/core/assets/src/api-resources/masteryLog.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ export default new Resource({
* Gets the list of mastery logs (tries) for a particular content and user combo, with:
* - `correct`: total correct for the try
*
* @param {String} content_id
* @param {String} user_id
* @param {Object} parameters - the parameters to be used for the fetch
* @param {String} parameters.content_id - the content_id of the relevant assessment
* @param {String} parameters.user_id - the id of the user
* @return {Promise}
*/
fetchSummary({ content_id, user_id } = {}) {
Expand All @@ -34,8 +35,9 @@ export default new Resource({
* - `diff`: object or null, with `correct` and `time_spent` diffs
* - `attemptlogs`: list of attempt logs with annotated diff with previous try's attempt
*
* @param {String} content_id
* @param {String} user_id
* @param {Object} parameters - the parameters to be used for the fetch
* @param {String} parameters.content_id - the content_id of the relevant assessment
* @param {String} parameters.user_id - the id of the user
* @return {Promise}
*/
fetchMostRecentDiff({ content_id, user_id } = {}) {
Expand Down
16 changes: 6 additions & 10 deletions kolibri/plugins/learn/assets/src/views/QuizRenderer/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -432,9 +432,8 @@
this.startTime = Date.now();
if (close) {
return this.setAndSaveCurrentExamAttemptLog({ close, interaction });
} else {
return this.debouncedSetAndSaveCurrentExamAttemptLog({ interaction });
}
return this.debouncedSetAndSaveCurrentExamAttemptLog({ interaction });
} else if (close) {
return this.setAndSaveCurrentExamAttemptLog({ close });
}
Expand All @@ -446,14 +445,11 @@
toggleModal() {
// Flush any existing save event to ensure
// that the subit modal contains the latest state
if (!this.submitModalOpen) {
const promise =
this.debouncedSetAndSaveCurrentExamAttemptLog.flush() || Promise.resolve();
return promise.then(() => {
this.submitModalOpen = !this.submitModalOpen;
});
}
this.submitModalOpen = !this.submitModalOpen;
Promise.resolve(
this.submitModalOpen && this.debouncedSetAndSaveCurrentExamAttemptLog.flush()
).then(() => {
this.submitModalOpen = !this.submitModalOpen;
});
},
finishExam() {
this.saveAnswer(true).then(() => {
Expand Down

0 comments on commit fd2c869

Please sign in to comment.