Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
arsnova-click-v2-frontend
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
12
Merge Requests
12
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
ARSnova
arsnova-click-v2-frontend
Commits
4c2b1b33
Commit
4c2b1b33
authored
Nov 30, 2019
by
Christopher Mark Fullarton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes correct / wrong calculation of ranged question answers
parent
ad33f6f9
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
13 deletions
+25
-13
src/app/lib/interfaces/quizzes/IQuizResponse.ts
src/app/lib/interfaces/quizzes/IQuizResponse.ts
+1
-1
src/app/quiz/quiz-flow/quiz-results/progress-bar/progress-bar.component.ts
...-flow/quiz-results/progress-bar/progress-bar.component.ts
+22
-10
src/app/quiz/quiz-manager/details/answeroptions/answeroptions-ranged/answeroptions-ranged.component.ts
...ns/answeroptions-ranged/answeroptions-ranged.component.ts
+2
-2
No files found.
src/app/lib/interfaces/quizzes/IQuizResponse.ts
View file @
4c2b1b33
export
interface
IQuizResponse
{
value
:
Array
<
number
>
|
number
|
string
;
value
:
Array
<
number
>
|
string
;
responseTime
:
number
;
confidence
:
number
;
readingConfirmation
:
boolean
;
...
...
src/app/quiz/quiz-flow/quiz-results/progress-bar/progress-bar.component.ts
View file @
4c2b1b33
...
...
@@ -72,21 +72,25 @@ export class ProgressBarComponent {
if
(
typeof
value
.
responses
[
this
.
questionIndex
]
===
'
undefined
'
||
value
.
responses
[
this
.
questionIndex
].
responseTime
===
-
1
)
{
return
false
;
}
const
responseValue
:
any
=
value
.
responses
[
this
.
questionIndex
].
value
;
if
(
!
responseValue
||
!
String
(
responseValue
).
length
||
(
Array
.
isArray
(
responseValue
)
&&
!
responseValue
.
length
))
{
const
responseValue
:
Array
<
number
>
|
string
=
value
.
responses
[
this
.
questionIndex
].
value
;
if
(
!
Array
.
isArray
(
responseValue
)
||
!
[
'
number
'
,
'
string
'
].
includes
(
typeof
responseValue
))
{
return
false
;
}
if
(
question
.
TYPE
===
QuestionType
.
FreeTextQuestion
)
{
const
answer
=
question
.
answerOptionList
[
0
]
=
new
FreeTextAnswerEntity
(
question
.
answerOptionList
[
0
]);
if
(
answer
.
isCorrectInput
(
responseValue
))
{
if
(
answer
.
isCorrectInput
(
responseValue
as
unknown
as
string
))
{
correct
++
;
}
else
{
wrong
++
;
}
}
else
if
(
question
.
TYPE
===
QuestionType
.
RangedQuestion
)
{
if
(
responseValue
===
question
.
correctValue
||
responseValue
!==
question
.
correctValue
&&
responseValue
>=
question
.
rangeMin
&&
responseValue
<=
question
.
rangeMax
)
{
const
parsedResponseValue
=
parseInt
(
responseValue
as
unknown
as
string
,
10
);
if
(
parsedResponseValue
===
question
.
correctValue
||
//
(
parsedResponseValue
>=
question
.
rangeMin
&&
//
parsedResponseValue
<=
question
.
rangeMax
))
{
correct
++
;
}
else
{
wrong
++
;
...
...
@@ -98,12 +102,16 @@ export class ProgressBarComponent {
base
--
;
question
.
answerOptionList
.
forEach
((
answer
,
answerIndex
)
=>
{
if
(
answer
.
isCorrect
)
{
if
((
<
any
>
responseValue
.
indexOf
(
answerIndex
))
>
-
1
)
{
if
((
responseValue
.
indexOf
(
answerIndex
)
)
>
-
1
)
{
correct
++
;
base
++
;
}
}
else
{
if
((
<
any
>
responseValue
.
indexOf
(
answerIndex
))
>
-
1
)
{
if
((
responseValue
.
indexOf
(
answerIndex
)
)
>
-
1
)
{
wrong
++
;
base
++
;
}
...
...
@@ -145,9 +153,13 @@ export class ProgressBarComponent {
if
(
Array
.
isArray
(
responseValue
))
{
if
(
isNaN
(
responseValue
[
0
]))
{
return
(
<
any
>
responseValue
.
indexOf
(
question
.
answerOptionList
[
answerIndex
].
answerText
))
>
-
1
;
return
(
<
any
>
responseValue
.
indexOf
(
question
.
answerOptionList
[
answerIndex
].
answerText
)
)
>
-
1
;
}
else
{
return
(
<
any
>
responseValue
.
indexOf
(
answerIndex
))
>
-
1
;
return
(
<
any
>
responseValue
.
indexOf
(
answerIndex
)
)
>
-
1
;
}
}
else
{
return
responseValue
===
answerIndex
;
...
...
@@ -169,7 +181,7 @@ export class ProgressBarComponent {
if
(
typeof
value
.
responses
[
this
.
questionIndex
]
===
'
undefined
'
)
{
return
false
;
}
const
responseValue
=
value
.
responses
[
this
.
questionIndex
].
value
;
const
responseValue
=
parseInt
(
value
.
responses
[
this
.
questionIndex
].
value
as
unknown
as
string
,
10
)
;
if
(
Array
.
isArray
(
responseValue
))
{
return
false
;
}
...
...
src/app/quiz/quiz-manager/details/answeroptions/answeroptions-ranged/answeroptions-ranged.component.ts
View file @
4c2b1b33
...
...
@@ -62,7 +62,7 @@ export class AnsweroptionsRangedComponent implements OnInit, OnDestroy {
.
subscribe
(
questionIndex
=>
{
this
.
_questionIndex
=
questionIndex
;
this
.
_question
=
<
RangedQuestionEntity
>
this
.
quizService
.
quiz
.
questionList
[
this
.
_questionIndex
]
;
this
.
_question
=
this
.
quizService
.
quiz
.
questionList
[
this
.
_questionIndex
]
as
RangedQuestionEntity
;
this
.
_minRange
=
String
(
this
.
_question
.
rangeMin
);
this
.
_maxRange
=
String
(
this
.
_question
.
rangeMax
);
this
.
_correctValue
=
String
(
this
.
_question
.
correctValue
);
...
...
@@ -75,7 +75,7 @@ export class AnsweroptionsRangedComponent implements OnInit, OnDestroy {
this
.
_question
.
rangeMax
=
parseInt
(
this
.
_maxRange
,
10
);
this
.
_question
.
correctValue
=
parseInt
(
this
.
_correctValue
,
10
);
this
.
quizService
.
quiz
.
questionList
[
this
.
_questionIndex
]
=
<
RangedQuestionEntity
>
this
.
_question
;
this
.
quizService
.
quiz
.
questionList
[
this
.
_questionIndex
]
=
this
.
_question
;
this
.
quizService
.
persist
();
this
.
_destroy
.
next
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment