Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Q
quiz-3346955
Manage
Activity
Members
Labels
Plan
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Issue forks
quiz-3346955
Commits
37f05d3a
Commit
37f05d3a
authored
15 years ago
by
falcon
Browse files
Options
Downloads
Patches
Plain Diff
Fixing scoring problems in matching
parent
2291a48e
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
question_types/matching/matching.classes.inc
+4
-4
4 additions, 4 deletions
question_types/matching/matching.classes.inc
with
4 additions
and
4 deletions
question_types/matching/matching.classes.inc
+
4
−
4
View file @
37f05d3a
...
...
@@ -261,7 +261,7 @@ class MatchingResponse extends AbstractQuizQuestionResponse {
parent
::
__construct
(
$result_id
,
$question_node
,
$answer
);
$this
->
is_correct
=
$this
->
isCorrect
();
if
(
!
isset
(
$answer
))
{
$sql
=
'SELECT ua.answer, score
$sql
=
'SELECT ua.answer, score
, ua.match_id
FROM {quiz_matching_user_answers} ua
JOIN {quiz_matching_node} n
ON n.match_id = ua.match_id
...
...
@@ -269,7 +269,7 @@ class MatchingResponse extends AbstractQuizQuestionResponse {
$res
=
db_query
(
$sql
,
$question_node
->
vid
);
$this
->
answer
=
array
();
while
(
$obj
=
db_fetch_object
(
$res
))
{
$this
->
answer
[
$obj
->
answer
]
=
$obj
->
answer
;
$this
->
answer
[
$obj
->
match_id
]
=
$obj
->
answer
;
}
}
}
...
...
@@ -300,8 +300,8 @@ class MatchingResponse extends AbstractQuizQuestionResponse {
public
function
score
()
{
$wrong_answer
=
0
;
$correct_answer
=
0
;
$user_answers
=
isset
(
$this
->
answer
)
?
$this
->
answer
:
$this
->
getUserA
nswer
s
()
;
$user_answers
=
isset
(
$user_answers
)
?
$user_answers
:
array
();
$user_answers
=
isset
(
$this
->
answer
[
'answer'
]
)
?
$this
->
answer
[
'answer'
]
:
$this
->
a
nswer
;
$user_answers
=
isset
(
$user_answers
)
?
$user_answers
:
$this
->
getUserAnswers
();
// to prevent warning : Invalid argument supplied for foreach()
foreach
((
array
)
$user_answers
as
$key
=>
$value
)
{
if
(
$key
!=
$value
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment