Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
IDATT-2501-Backend
Manage
Activity
Members
Labels
Plan
Issues
32
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TrioTech
IDATT-2501-Backend
Merge requests
!73
Resolve "Split game object and add events readAnswer and questionEnd"
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Resolve "Split game object and add events readAnswer and questionEnd"
151-split-game-object-and-add-events-readanswer-and-questionend
into
main
Overview
0
Commits
12
Pipelines
13
Changes
2
Merged
Pedro Pablo Cardona Arroyave
requested to merge
151-split-game-object-and-add-events-readanswer-and-questionend
into
main
1 year ago
Overview
0
Commits
12
Pipelines
13
Changes
2
Expand
Closes
#151 (closed)
0
0
Merge request reports
Viewing commit
b42acbc3
Prev
Next
Show latest version
2 files
+
11
−
9
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
2
Search (e.g. *.vue) (Ctrl+P)
b42acbc3
Bug fix
· b42acbc3
John Fredrik Bendvold
authored
1 year ago
models/game.model.js
+
6
−
5
Options
@@ -26,7 +26,7 @@ class Game {
10
,
);
}
console
.
log
(
questions
);
//
console.log(questions);
for
(
let
i
=
0
;
i
<
questions
.
length
;
i
++
)
{
const
answers
=
await
answerController
.
getAnswerForQuestion
(
questions
[
i
].
_id
);
this
.
gameData
[
i
]
=
{
@@ -38,16 +38,17 @@ class Game {
this
.
usersAnswers
.
set
(
user
,
[]);
}
console
.
log
(
this
.
gameData
);
//
console.log(this.gameData);
return
this
.
gameData
;
}
addNewAnswer
(
user
,
answer
)
{
this
.
usersAnswers
.
get
(
user
)
.
push
(
answer
)
;
return
this
.
verifyAnswer
(
this
.
usersAnswers
.
get
(
user
).
length
-
1
,
answer
);
addNewAnswer
(
user
,
answer
,
index
)
{
this
.
usersAnswers
.
get
(
user
)
[
index
]
=
answer
;
return
this
.
verifyAnswer
(
index
,
answer
);
}
verifyAnswer
(
questionNumber
,
answer
)
{
console
.
log
(
this
.
gameData
[
questionNumber
]);
return
this
.
gameData
[
questionNumber
].
answers
[
answer
].
is_correct
;
}
Loading