Skip to content

Move "deleted" submissions to separate table - #36

Closed
efischer19 wants to merge 2 commits into
masterfrom
efischer/archive_table
Closed

Move "deleted" submissions to separate table#36
efischer19 wants to merge 2 commits into
masterfrom
efischer/archive_table

Conversation

@efischer19

Copy link
Copy Markdown
Contributor

Consider this option 4 in the "how should we soft delete Submissions" balloting.

Testing on my devstack now.

migrations.CreateModel(
name='SubmissionDeleted',
fields=[
('submission_ptr', models.OneToOneField(parent_link=True, auto_created=True, primary_key=True, serialize=False, to='submissions.Submission')),

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's not right, delete() will cascade and get this too.

Hang on...

@efischer19
efischer19 force-pushed the efischer/archive_table branch from cb334b9 to 0d2847b Compare February 9, 2016 14:33
@efischer19 efischer19 changed the title Efischer/archive table Move "deleted" submissions to separate table Feb 9, 2016
@efischer19
efischer19 force-pushed the efischer/archive_table branch from 0d2847b to 9bb69ca Compare February 9, 2016 14:46
@efischer19

Copy link
Copy Markdown
Contributor Author

Aha! Finally got it work. I can confirm that this behaves as we want in ORA (submission becomes inaccessible both to staff tools and grading pools), and here's what the data looks like on the backend:

mysql> select * from submissions_submission;
+----+--------------------------------------+----------------+----------------------------+----------------------------+---------------------------------------------------------------------------+-----------------+
| id | uuid                                 | attempt_number | submitted_at               | created_at                 | raw_answer                                                                | student_item_id |
+----+--------------------------------------+----------------+----------------------------+----------------------------+---------------------------------------------------------------------------+-----------------+
|  2 | 9e52e9b0-cf4a-11e5-9d07-080027880ca6 |              1 | 2016-02-09 16:31:49.542878 | 2016-02-09 16:31:49.542890 | {"parts":[{"text":"staff response 2 no secrets here"}]}                   |               1 |
|  3 | c2e07982-cf4a-11e5-b5e4-080027880ca6 |              1 | 2016-02-09 16:32:50.868396 | 2016-02-09 16:32:50.868411 | {"parts":[{"text":"honor response I sure hope I don't see any secrets"}]} |               2 |
+----+--------------------------------------+----------------+----------------------------+----------------------------+---------------------------------------------------------------------------+-----------------+
2 rows in set (0.00 sec)

mysql> select * from submissions_submissiondeleted;
+----+--------------------------------------+----------------+----------------------------+----------------------------+----------------------------------------------------------------------------------------------------+-----------------+
| id | uuid                                 | attempt_number | submitted_at               | created_at                 | raw_answer                                                                                         | student_item_id |
+----+--------------------------------------+----------------+----------------------------+----------------------------+----------------------------------------------------------------------------------------------------+-----------------+
|  1 | 84f21e32-cf4a-11e5-ab5a-080027880ca6 |              1 | 2016-02-09 16:31:06.965412 | 2016-02-09 16:31:06.965426 | {"parts":[{"text":"staff response 1 oh no I made a terrible mistake and revealed a huge secret"}]} |               1 |
+----+--------------------------------------+----------------+----------------------------+----------------------------+----------------------------------------------------------------------------------------------------+-----------------+
1 row in set (0.00 sec)

To fix the buggy behavior reported in TNL-3880, we need to ensure
that the submission we're dropping is unlinked from the student_item
used to find it. This prevents code (say, an ORA staff tool) from
constructing a student item with an id, a course, and a problem, and
using that to find a "cleared" submission.

Also includes migration for adding SubmissionDeleted model
@efischer19
efischer19 force-pushed the efischer/archive_table branch from 481681f to c0abeb2 Compare February 10, 2016 14:47
@efischer19 efischer19 closed this Feb 18, 2016
@nsprenkle
nsprenkle deleted the efischer/archive_table branch November 12, 2021 20:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant