Skip to content

Commit c619f71

Browse files
committed
Merge branch 'master' into fixfeature/makeuserstatsasitesetting
2 parents 7b022ef + 5dbcb20 commit c619f71

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

classes/ratings.php

+5-7
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,7 @@ public static function moodleoverflow_add_rating($moodleoverflow, $postid, $rati
121121
}
122122

123123
// Delete the rating.
124-
self::moodleoverflow_remove_rating($postid, $rating / 10, $userid, $modulecontext);
125-
126-
return true;
124+
return self::moodleoverflow_remove_rating($postid, $rating / 10, $userid, $modulecontext);
127125
}
128126

129127
// Check for an older rating in this discussion.
@@ -641,8 +639,8 @@ private static function moodleoverflow_check_old_rating($postid, $userid, $oldra
641639
// Get the solved rating.
642640
$sql = "SELECT *
643641
FROM {moodleoverflow_ratings}
644-
WHERE userid = ? AND postid = ? AND rating = 3";
645-
$rating['solved'] = $DB->get_record_sql($sql, [ $userid, $postid ]);
642+
WHERE postid = ? AND rating = 3";
643+
$rating['solved'] = $DB->get_record_sql($sql, [ $postid ]);
646644

647645
// Return the rating if it is requested.
648646
if ($oldrating == RATING_SOLVED) {
@@ -652,8 +650,8 @@ private static function moodleoverflow_check_old_rating($postid, $userid, $oldra
652650
// Get the helpful rating.
653651
$sql = "SELECT *
654652
FROM {moodleoverflow_ratings}
655-
WHERE userid = ? AND postid = ? AND rating = 4";
656-
$rating['helpful'] = $DB->get_record_sql($sql, [ $userid, $postid ]);
653+
WHERE postid = ? AND rating = 4";
654+
$rating['helpful'] = $DB->get_record_sql($sql, [ $postid ]);
657655

658656
// Return the rating if it is requested.
659657
if ($oldrating == RATING_HELPFUL) {

0 commit comments

Comments
 (0)