Skip to content
This repository has been archived by the owner on Dec 19, 2023. It is now read-only.

Selecting everyone else's submissions is incorrect #38

Open
xanderdunn opened this issue Nov 12, 2017 · 0 comments
Open

Selecting everyone else's submissions is incorrect #38

xanderdunn opened this issue Nov 12, 2017 · 0 comments
Assignees

Comments

@xanderdunn
Copy link
Contributor

xanderdunn commented Nov 12, 2017

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant