Affects Version/s: 3.5.12, 3.6.10, 3.7.6, 3.8.3, 3.9
Fix Version/s: None
The code to award a badge when the criteria requires being a member of multiple cohorts is broken.
It appears that the WHERE clause that's generated when seeing if a person is a member of ALL required cohorts doesn't work.
In criteria/award_criteria_cohort line 247ish reads:
$where = ' AND cm.cohortid = :cohortid'.$i;
When I believe it should read:
$where .= ' AND cm.cohortid = :cohortid'.$i;
So a person could gain the badge if they were only a member of the last cohort, not all cohorts, because the AND clause only includes the last cohortid.
I was looking at MDL-63120 and ran across this line, which I'm pretty sure is just a simple oversight bug, but I'm definitely not a) a php programmer or b) overly familiar with the cohort award code.