Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add first_active field to BlossomUser model #147

Closed
wants to merge 2 commits into from

Conversation

TimJentzsch
Copy link
Contributor

@TimJentzsch TimJentzsch commented Jun 13, 2021

Relevant issue: Closes #141.

Description:

The Slack info command used the date_joined field of BlossomUser. However, this is actually never assigned anywhere, so it always returned the current time.
This adds a separate first_active field which returns the time of the first claimed transcription. This is then used instead of the date_joined field for the info command.

Testing Instructions:

Locally setup the Blossom Testing App. Then you can test the info <username> command and verify that the date_joined field has been replaced by first_active and returns a sensible value.

Because I didn't manage to set up Slack locally yet, it would be nice if someone could verify this for me.

Checklist:

  • Code Quality
  • Pep-8
  • Tests (if applicable)
  • Success Criteria Met
  • Inline Documentation
  • Wiki Documentation (if applicable)

@TimJentzsch TimJentzsch marked this pull request as ready for review June 13, 2021 14:37
@TimJentzsch TimJentzsch requested a review from a team as a code owner June 13, 2021 14:37
@TimJentzsch TimJentzsch changed the title [WIP] Add first_active field to BlossomUser model Add first_active field to BlossomUser model Jun 13, 2021
@itsthejoker
Copy link
Member

date_joined is actually when the object was created in the database, so anyone who accepts the code of conduct now has an accurate date_joined field. What would probably be a better option here is going through and resetting that field in the db to be the claim time of their first submission if we have that available.

:return: the date when the user was first active or None if they haven't
transcribed yet.
"""
first_claim = (
Copy link
Member

Choose a reason for hiding this comment

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

Do we know anything about the performance of this query? It sounds like it could be quite detrimental to execution time if there's many submissions, especially since they have to be sorted. Wouldn't we be better off just making this an additional field of the user, since this date does not change after the initial claim?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think it would be quite fast, but it's probably better to do it as @itsthejoker suggested and to just fix the date_joined field to actually be correct

@TimJentzsch
Copy link
Contributor Author

I will close this and instead we can fix the date_joined field.

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.

Fix date_joined field in Slack info command
3 participants