Wrong topic is sometimes wrong for auto-assigned assignments #84

nilbus opened this Issue Mar 23, 2011 · 1 comment


None yet

2 participants

nilbus commented Mar 23, 2011

For example, when logged in as sgao, after selecting Wiki Textbook 2011, Others' Work, Chapter 5; chapter 4a is assigned.


This isn't actually a bug in the code, but an inconsistency in the database due to a manual change made about a month ago.

The problem is due to a DB design issue. When an assignment is a team assignment, the topic_id is stored on every participant, and not the team itself. This leads to redundant data and it may cause ambiguities like in this case.

The following query proves my point (the result should be empty, but it shows a team with 2 different topics):

select a.team_id from
(select distinct tu.team_id, p.topic_id
from participants p, teams_users tu, teams t 
where p.type = 'AssignmentParticipant' 
and p.parent_id = 320 and tu.user_id = p.user_id 
and t.id = tu.team_id and t.type = 'AssignmentTeam' and t.parent_id = 320) as a
group by a.team_id
having count(a.topic_id) > 1;

| team_id |
|    3047 |

I will change the DB to make it consistent again.

@mgdelcar mgdelcar closed this Mar 24, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment