-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1034 from slidewiki/SWIK-2488-Enable_selection_of…
…_questions_for_exam_mode Swik 2488 enable selection of questions for exam mode
- Loading branch information
Showing
24 changed files
with
783 additions
and
238 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
const log = require('../log/clog'); | ||
|
||
export default function invertExamListFlag(context, payload, done) { | ||
log.info(context); | ||
context.dispatch('INVERT_EXAM_LIST_FLAG', payload); | ||
done(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
const log = require('../log/clog'); | ||
import ContentQuestionsStore from '../../stores/ContentQuestionsStore'; | ||
import deckContentTypeError from '../error/deckContentTypeError'; | ||
import serviceUnavailable from '../error/serviceUnavailable'; | ||
import slideIdTypeError from '../error/slideIdTypeError'; | ||
import { AllowedPattern } from '../error/util/allowedPattern'; | ||
export default function loadExamQuestions(context, payload, done) { | ||
log.info(context); | ||
const selector = context.getStore(ContentQuestionsStore).selector; | ||
const sid = (selector.sid) ? selector.sid.split('-')[0] : ''; | ||
if (payload.params.sid.split('-')[0] !== sid || payload.params.stype !== selector.stype) { | ||
|
||
if (!(['deck', 'slide', 'question'].indexOf(payload.params.stype) > -1 || payload.params.stype === undefined)){ | ||
context.executeAction(deckContentTypeError, payload, done); | ||
return; | ||
} | ||
|
||
if (!(AllowedPattern.SLIDE_ID.test(payload.params.sid) || payload.params.sid === undefined)) { | ||
context.executeAction(slideIdTypeError, payload, done); | ||
return; | ||
} | ||
|
||
context.service.read('questions.examlist', payload, {timeout: 20 * 1000}, (err, res) => { | ||
if (err) { | ||
log.error(context, {filepath: __filename}); | ||
context.executeAction(serviceUnavailable, payload, done); | ||
} else { | ||
context.dispatch('LOAD_CONTENT_QUESTIONS_SUCCESS', res); | ||
context.dispatch('UPDATE_MODULE_TYPE_SUCCESS', {moduleType: 'questions'}); | ||
} | ||
|
||
done(); | ||
}); | ||
} else { | ||
done(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import log from '../log/clog'; | ||
export default function resetExamAnswers(context, payload, done) { | ||
log.info(context); | ||
context.dispatch('RESET_ANSWERS', payload); | ||
done(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import log from '../log/clog'; | ||
export default function selectExamAnswer(context, payload, done) { | ||
log.info(context); | ||
context.dispatch('QUESTION_ANSWER_SELECTED', payload); | ||
done(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import log from '../log/clog'; | ||
export default function showCorrectExamAnswers(context, payload, done) { | ||
log.info(context); | ||
context.dispatch('SHOW_CORRECT_EXAM_ANSWERS', payload); | ||
done(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
const log = require('../log/clog'); | ||
import serviceUnavailable from '../error/serviceUnavailable'; | ||
import ContentQuestionsStore from '../../stores/ContentQuestionsStore'; | ||
|
||
export default function updateExamList(context, payload, done) { | ||
log.info(context, payload); | ||
|
||
context.service.update('questions.updateExamList', {modifiedSelections: payload.modifiedSelections}, {timeout: 20 * 1000}, (err, res) => { | ||
if (err) { | ||
log.error(context, {filepath: __filename}); | ||
context.executeAction(serviceUnavailable, payload, done); | ||
} else { | ||
context.dispatch('UPDATE_QUESTIONS', payload); | ||
} | ||
done(); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.