Moodle Community Sites

Automatically assign people to PHM group in cours "Moodle en français"

Details

  • Type: New Feature New Feature
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Fixed
  • Component/s: moodle.org
  • Labels:
    None

Description

Hi Eloy,
I would like to assing people to a PHM group in course Moodle en français (see http://moodle.org/mod/forum/discuss.php?d=132809).

Here is the information of the IDs of the course, group and scale.

courseid: 20
groupid: 195
scaleid: 84

The current scale works with stars. I would like to change it the same way as in Using Moodle, in a two degree scale ("utile, "pas utile"). What will happen with current evaluations if I change the scale manually ? Is there a way to convert by formula the current values to other values. AFAIK it was done in Using Moodle, but I can't remember how.

Thanks, Nicolas

Activity

Hide
Eloy Lafuente (stronk7) added a comment -

Hi Nicolas,

the script is in place, as commented by email. It's now in read-only mode, so the results you see aren't being used to populate the group. Just tell me if you want me to enable it definitively.

About the scales... they are used only to detect the forums to use for calculations. The value given in the rating doesn't account at all. Just the fact of being rated. In any case, I agree it has more sense to have one 1-value scale ("useful"), but 2 or more values doesn't account at all.

So, tell me if you want to have that 1-value scale or you want to continue with the 5-value-starred one. The key is that values doesn't account at all, only the existence of ratings.

Ciao

Show
Eloy Lafuente (stronk7) added a comment - Hi Nicolas, the script is in place, as commented by email. It's now in read-only mode, so the results you see aren't being used to populate the group. Just tell me if you want me to enable it definitively. About the scales... they are used only to detect the forums to use for calculations. The value given in the rating doesn't account at all. Just the fact of being rated. In any case, I agree it has more sense to have one 1-value scale ("useful"), but 2 or more values doesn't account at all. So, tell me if you want to have that 1-value scale or you want to continue with the 5-value-starred one. The key is that values doesn't account at all, only the existence of ratings. Ciao
Hide
Nicolas Martignoni added a comment -

The script works very well, and you can enable it definitively.

For the scale: yes I would like a 1-value scale. And thanks for the work !

Ciao !

Show
Nicolas Martignoni added a comment - The script works very well, and you can enable it definitively. For the scale: yes I would like a 1-value scale. And thanks for the work ! Ciao !
Hide
Eloy Lafuente (stronk7) added a comment -
  • Script enabled
  • Created 1-value scale (96) "Utile"
  • Executed the script and now the group has members.

Last point is how do you want to convert old scale ratings to new ones. Are you going to, simply, change the scale in the activities or perhaps some conversion of ratings should happen too (like "all the ratings being >2 in original scale become "utile" and the rest are discarded).

For your consideration, ciao

Show
Eloy Lafuente (stronk7) added a comment -
  • Script enabled
  • Created 1-value scale (96) "Utile"
  • Executed the script and now the group has members.
Last point is how do you want to convert old scale ratings to new ones. Are you going to, simply, change the scale in the activities or perhaps some conversion of ratings should happen too (like "all the ratings being >2 in original scale become "utile" and the rest are discarded). For your consideration, ciao
Hide
Nicolas Martignoni added a comment -

Excellent, thank you !

Re converting the old ratings, have you some way to make it the way you discribe ("ratings being >2 in original scale become "utile" and the rest are discarded"? That seems to me the better to do, or can you tell me how to do it automatically?

Ciao

Show
Nicolas Martignoni added a comment - Excellent, thank you ! Re converting the old ratings, have you some way to make it the way you discribe ("ratings being >2 in original scale become "utile" and the rest are discarded"? That seems to me the better to do, or can you tell me how to do it automatically? Ciao
Hide
Eloy Lafuente (stronk7) added a comment -

Ah, it must be done directly against the DB. I can do it. Just confirm me the exact rule to follow.

I will switch ALL your old scale (84) uses to the new one (96) performing the change in ratings as ruled by you.

Ciao

Show
Eloy Lafuente (stronk7) added a comment - Ah, it must be done directly against the DB. I can do it. Just confirm me the exact rule to follow. I will switch ALL your old scale (84) uses to the new one (96) performing the change in ratings as ruled by you. Ciao
Hide
Nicolas Martignoni added a comment -

OK then, please use this rule : ratings being >3 (three) in original scale become "utile" and the rest are discarded.

Ciao

Show
Nicolas Martignoni added a comment - OK then, please use this rule : ratings being >3 (three) in original scale become "utile" and the rest are discarded. Ciao
Hide
Eloy Lafuente (stronk7) added a comment -

Done:

29 ratings with value <=3 has been deleted
1324 remaining ratings have been converted to "useful"
4 forums have been changed from old scale to new one

For the records, these are the SQLs executed:

--- Delete any rating in course & scale specified being <=3

DELETE FROM forum_ratings
WHERE rating <=3
  AND post IN (
    SELECT fp.id
      FROM forum_posts fp
      JOIN forum_discussions fd ON fp.discussion = fd.id
      JOIN forum f ON fd.forum = f.id
     WHERE f.course = 20
       AND f.scale = -84
)

-- Change all the remaining ratings in course & scale to 1 (useful 1-scale value)

UPDATE forum_ratings SET rating = 1
WHERE post IN (
    SELECT fp.id
      FROM forum_posts fp
      JOIN forum_discussions fd ON fp.discussion = fd.id
      JOIN forum f ON fd.forum = f.id
     WHERE f.course = 20
       AND f.scale = -84
)

-- Change all the forums using one scale to the new one

UPDATE forum SET scale = -96
WHERE course = 20
  AND scale = -84
Show
Eloy Lafuente (stronk7) added a comment - Done: 29 ratings with value <=3 has been deleted 1324 remaining ratings have been converted to "useful" 4 forums have been changed from old scale to new one For the records, these are the SQLs executed:
--- Delete any rating in course & scale specified being <=3

DELETE FROM forum_ratings
WHERE rating <=3
  AND post IN (
    SELECT fp.id
      FROM forum_posts fp
      JOIN forum_discussions fd ON fp.discussion = fd.id
      JOIN forum f ON fd.forum = f.id
     WHERE f.course = 20
       AND f.scale = -84
)

-- Change all the remaining ratings in course & scale to 1 (useful 1-scale value)

UPDATE forum_ratings SET rating = 1
WHERE post IN (
    SELECT fp.id
      FROM forum_posts fp
      JOIN forum_discussions fd ON fp.discussion = fd.id
      JOIN forum f ON fd.forum = f.id
     WHERE f.course = 20
       AND f.scale = -84
)

-- Change all the forums using one scale to the new one

UPDATE forum SET scale = -96
WHERE course = 20
  AND scale = -84
Hide
Eloy Lafuente (stronk7) added a comment -

Reolving this as fixed. I think now everything is in place. Nicolas, you can delete the old scale if you aren't going to use it anymore... ciao

Show
Eloy Lafuente (stronk7) added a comment - Reolving this as fixed. I think now everything is in place. Nicolas, you can delete the old scale if you aren't going to use it anymore... ciao
Hide
Nicolas Martignoni added a comment -

Verified, everything works as described.

Many thanks to Eloy!

Show
Nicolas Martignoni added a comment - Verified, everything works as described. Many thanks to Eloy!

People

Vote (1)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: