Petr - I will not have a chance to look at this soon so I am reassigning to you as I do not want to hold things up. However, feel free to re-assign it back to me if you want. Since you have been working on the forum code I thought it might be best for you to handle it. In either case, I need your two cents on how best to handle it.
I see this has a fairly minor bug as it only affects (AFAIK) when the user is doing a count and the scale is using the scale "Separate and Connected Knowing" (which happens to be the default). This combination does not make sense - i.e. to count this scale so it should be a rare situation. In any case, it would be nice to check for this. I am getting a PHP notice:
Notice: Undefined offset: 0 in /home/arborrow/Moodle/code/19stable/mod/forum/lib.php on line 2880
(it's related to the forum_get_ratings_count function)
That particular scale produces an array with elements [1], [2], and [3]. In other words the scale does not start with 0 as the current code assumes. Perhaps the simplest approach would be to test that if the $forum->scale == -1 and the count of the ratings is 0 then return the first element of the array although this seems to be misleading.
Another idea is to simply not allow the counting of this particular scale and give the user a warning. Or we could rely on the user's common sense to not select a combination that does not make sense.
Peace - Anthony
Petr - I will not have a chance to look at this soon so I am reassigning to you as I do not want to hold things up. However, feel free to re-assign it back to me if you want. Since you have been working on the forum code I thought it might be best for you to handle it. In either case, I need your two cents on how best to handle it.
I see this has a fairly minor bug as it only affects (AFAIK) when the user is doing a count and the scale is using the scale "Separate and Connected Knowing" (which happens to be the default). This combination does not make sense - i.e. to count this scale so it should be a rare situation. In any case, it would be nice to check for this. I am getting a PHP notice:
Notice: Undefined offset: 0 in /home/arborrow/Moodle/code/19stable/mod/forum/lib.php on line 2880
(it's related to the forum_get_ratings_count function)
That particular scale produces an array with elements [1], [2], and [3]. In other words the scale does not start with 0 as the current code assumes. Perhaps the simplest approach would be to test that if the $forum->scale == -1 and the count of the ratings is 0 then return the first element of the array although this seems to be misleading.
Another idea is to simply not allow the counting of this particular scale and give the user a warning. Or we could rely on the user's common sense to not select a combination that does not make sense.
Peace - Anthony