submission-criteria icon indicating copy to clipboard operation
submission-criteria copied to clipboard

Selecting everyone else's submissions is incorrect

Open xanderdunn opened this issue 6 years ago • 0 comments

Currently, we get all the submissions for originality to compare to with this query:

        query = """
        SELECT s.id FROM submissions s
        INNER JOIN originalities o
          ON s.id = o.submission_id
        WHERE s.round_id = %s AND
          s.user_id != %s AND
          s.inserted_at < %s AND
          s.selected = TRUE AND
          (o.value = TRUE OR o.pending = TRUE)
        ORDER BY s.inserted_at DESC"""

This is incorrect because of the selected = TRUE. This query would only be correct if it were run at the exact moment the submission were made, which is rarely the case because it's waiting in a queue. As users make new submissions, their old submissions will no longer have selected = TRUE, even though they did have selected = TRUE at the time my submission was made. Essentially, originality will be easier to achieve the longer the submission waits in the queue because the number of submissions that are both older than mine and selected = TRUE can only decrease as the same users make more submissions.

xanderdunn avatar Nov 12 '17 03:11 xanderdunn