Skip to content
This repository has been archived by the owner on Feb 8, 2018. It is now read-only.

Commit

Permalink
mend
Browse files Browse the repository at this point in the history
  • Loading branch information
krutam committed Sep 30, 2017
1 parent 7a7636c commit a940c71
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/controllers/question.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export async function checkAnswer(ctx) {
await UserAnswer.create(
{ questionId: question.id, userId: user.id, useranswer: ctx.body.answer}
)
if (correctAttempts==0) {
if (correctAttempts==0 && (ctx.body.answer in answers)) {
const { user } = ctx.state
if (user.maxUnlock == qno) {
user.maxUnlock += 1
Expand All @@ -44,7 +44,7 @@ export async function checkAnswer(ctx) {
}
ctx.body = { response: true }
}
else if(correctAttempts==1 && (ctx.body.answer in answers)) ctx.body = { response: "Already attempted" }
else if(correctAttempts==1) ctx.body = { response: "Already attempted" }
else ctx.body = { response: false }

}
Expand Down

0 comments on commit a940c71

Please sign in to comment.