Skip to content
This repository was archived by the owner on Jun 1, 2024. It is now read-only.
This repository was archived by the owner on Jun 1, 2024. It is now read-only.

De-dupe assignments #48

@hcientist

Description

@hcientist

It should not be possible (as is currently the case in prod 😅) for a teacher to assign the same activity to the same student for the same piece.

Proposed resolution:

  1. Update the assignment model to have this constraint (unique across 3 assignment fields: activity, enrollment, piece)
  2. makemigrations
    1. update the autogenerated migration to have a cleanup process that runs first (before the operation that adds the unique constraint) which will:
      1. for each enrollment
        1. for each piece
          1. for each activity
            1. determine if there are "duplicate" assignments (aggregate a "dupe_set")
              1. if there are, try to see whether more than 1 has a submission:
                1. if there is exactly 1 assignment in the "dupe_set" with submissions, delete all other assignments in the "dupe_set"
                2. elif there are 0 with submissions, delete all but the most recent assignments in the "dupe_set"
                3. elif there are > 1 with submissions, find the one with the most recent submission or submissionattachment and keep this and delete the others.

see the de-dupe-assns branch

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions