Skip to content

Commit

Permalink
edited update quiz service
Browse files Browse the repository at this point in the history
  • Loading branch information
OlyaKorchan committed Dec 1, 2023
1 parent 221eaaf commit 9197208
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
2 changes: 1 addition & 1 deletion models/quiz.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const quizSchema = new Schema(
values: QUIZ_VIEW_ENUM,
message: ENUM_CAN_BE_ONE_OF('quiz view', QUIZ_VIEW_ENUM)
},
default: 'Scroll'
default: QUIZ_VIEW_ENUM[1]
},
shuffle: {
type: Boolean,
Expand Down
10 changes: 4 additions & 6 deletions services/quiz.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,10 @@ const quizService = {

const { settings } = updateData

if (settings) {
for (let props in settings) {
quiz.settings[props] = settings[props]
}
} else {
for (let field in updateData) {
for (let field in updateData) {
if (field === 'settings') {
Object.assign(quiz.settings, settings)
} else {
quiz[field] = updateData[field]
}
}
Expand Down

0 comments on commit 9197208

Please sign in to comment.