Grades appear to be lost after moving discussion to new forum

Grades appear to be lost after moving discussion to new forum

by Barry Bookout -
Number of replies: 0
We had an instance where an instructor (accidentally) moved a discussion thread from one forum to another. The new forum had a lower maximum rating than the old one, so when the instructor went into the new forum, it appeared that many of the grades had disappeared (since there wasn't an available rating in the list to match those with values higher than the maximum rating of the new forum.)

The grades remain in the forum_post_ratings table unless/until the instructor submits the forum grading page. In that event, all the forum posts with "Rate..." selected in the rating select box (which includes the higher rating posts) will be removed from the forum_ratings table.

I have made some modifications to the mod/forum/lib.php file so that, in the event that the forum post has a rating higher than the maximum for the forum, that specific rating is added to the select list, and is selected. The diff between it and the old file is below, in case anyone is interested. I've also attached it to this post (the new lib file is too large to attach.)

This is for Moodle version Moodle 1.7.2 + (2006101020)

>> diff lib.php.orig lib.php.new
1983d1982
<
2211a2211,2215
>
> // we will need the max forum rating later
> if (!$forum = get_record("forum", "id", $post->forum)) {
> return false;
> }
2219c2223
< forum_print_rating_menu($post->id, $USER->id, $ratings->scale);
---
> forum_print_rating_menu($post->id, $USER->id, $ratings->scale, $forum->scale);
2227c2231
< forum_print_rating_menu($post->id, $USER->id, $ratings->scale);---
> forum_print_rating_menu($post->id, $USER->id, $ratings->scale, $forum->scale);
2527c2531
< function forum_print_rating_menu($postid, $userid, $scale) {
---
> function forum_print_rating_menu($postid, $userid, $scale, $max_rating) {
2530a2535
> /// max_rating is the largest rating for this forum (new)
2539a2545,2548
> }
> // new to allow over-rated posts (from moved discussions, presumably)
> if ($rating->rating > $max_rating) {
> $scale[$rating->rating] = $rating->rating . ' / ' . $max_rating;
Average of ratings: -