Moodle

deprecatedlib get_group_teacher doesn't work as expected

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 1.7.2
  • Fix Version/s: 1.8.1
  • Component/s: Assignment, Libraries
  • Labels:
    None
  • Affected Branches:
    MOODLE_17_STABLE
  • Fixed Branches:
    MOODLE_18_STABLE

Description

Group separated assignments don't notify teachers of students' uploads. This problem comes from deprecatedlib, which is not role-aware. I suggest this new get_group_teachers function (of course, I tested and it worked).

function get_group_teachers_new( $courseid, $groupid) {
if ( $teachers = get_course_teachers( $courseid)) {
foreach ( $teachers as $key => $teacher) {
if ( ( has_capability( 'mod/assignment:grade',get_context_instance( CONTEXT_COURSE, $courseid),$teacher->id)) and ismember( $groupid, $teacher->id)){ continue; }
unset( $teachers[$key]);
}
}
return $teachers;
}

Activity

Hide
Martin Dougiamas added a comment -

Petr can you fix this? Not with a new core get_group_teacher function ... we just need to replace the deprecated call with proper logic that uses capabilities.

Show
Martin Dougiamas added a comment - Petr can you fix this? Not with a new core get_group_teacher function ... we just need to replace the deprecated call with proper logic that uses capabilities.
Hide
Pablo Etcheverry added a comment -

Sorry, I slipped an error here, I didn't intend to make a new function, but to replace the existing get_group_teachers function. I accidentally added the "_new" suffix, but it shouldn't be there...
This function assumes that any user with 'mod/assignment:grade' should be considered a teacher in this way.

I have just noticed that 1.8 still has the same non-working function.

Show
Pablo Etcheverry added a comment - Sorry, I slipped an error here, I didn't intend to make a new function, but to replace the existing get_group_teachers function. I accidentally added the "_new" suffix, but it shouldn't be there... This function assumes that any user with 'mod/assignment:grade' should be considered a teacher in this way. I have just noticed that 1.8 still has the same non-working function.
Hide
Petr Škoda (skodak) added a comment -

hi,
this problem was already fixed in 1.8.1 - it does not use the deprecated function anymore for sending of emails. Many other bugs were fixed in 1.8.x only - that is why I recommend upgrading to latest 1.8.x version.

thanks for the report anyway.

Show
Petr Škoda (skodak) added a comment - hi, this problem was already fixed in 1.8.1 - it does not use the deprecated function anymore for sending of emails. Many other bugs were fixed in 1.8.x only - that is why I recommend upgrading to latest 1.8.x version. thanks for the report anyway.

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: