GSA / smartpay-training

Prototype for new GSA SmartPay training quizzes
8 stars 4 forks source link

BUG - Duplicate Entries in Department of State Report #419

Closed rebekahperillo closed 11 months ago

rebekahperillo commented 11 months ago

When a Department of State user downloaded a training report, it showed several duplicates.

I also looked at GSA and Department of Treasury data, and while there were a few duplicates, it wasn't as common.

SmartPayTrainingQuizCompletionReport (5) (1).csv

@mark-meyer Would you mind taking a look at this?

mark-meyer commented 11 months ago

We are seeing multiple quiz results in quick succession in the database. Our initial thought is that the user is double/triple clicking the submit button, which is creating multiple records in the database. It's possible some users are on slow networks, which could allow several clicks before the API scores the test and confirms it. If this is the problem, then disabling the submit button after the first click prevent this.

rebekahperillo commented 11 months ago

@mark-meyer Thank you, Mark. So, what are the next steps here?

mark-meyer commented 11 months ago

@rebekahperillo we pushed a version to staging the disables the quiz submit button after the user clicks it. This should prevent users from double-clicking, of clicking multiple time is their network is slow. It is up on staging — it's a little hard to test if you are on a fast connection, but we have been able to test it by artificially delaying the response.

Another thing to consider is what to do with existing records in the database. Is there ever a reason to show anything other than the most recently passed version of a quiz for a particular user?

rebekahperillo commented 11 months ago

@mark-meyer Thank you, Mark. In my opinion, if the user took the quiz multiple times (even two times in a row with passing scores), it should be reflected in their profile. Does this answer your question?

mark-meyer commented 11 months ago

Thanks @rebekahperillo Yes, that answers part of the question. But also, does that also apply to the AOPC report? Will the people looking at the report want to see multiple rows if the user took the quiz multiple times?

rebekahperillo commented 11 months ago

@mark-meyer I actually don't think this will happen that often, so I think it's OK to include multiple rows when a user takes the quiz multiple times. If anyone feels differently, I'm open to another approach.

rebekahperillo commented 11 months ago

@mark-meyer I tried to push the "Submit" button a bunch of times after completing the quiz, but it looks like my connection is fast (and I only see one record in the report for the quiz that I completed). I will trust that you were able to fix the issue when you tested it by artificially delaying the response. Moving to DONE, thank you!

rebekahperillo commented 11 months ago

@mark-meyer Also, are you going to push to prod now? Do you need anything else from me? Thank you again!

mark-meyer commented 11 months ago

@rebekahperillo Yes, we'll push this to production soon. We will probably want to clean up the existing data to get rid of multiple quiz submissions. This might be a little fussy since we need to find groups of quizzes that were submitted in quick succession. @weiwang-gsa and I will talk about it.

mark-meyer commented 11 months ago

@rebekahperillo This should now be up on prod.

weiwang-gsa commented 11 months ago

@mark-meyer I just checked on production DB, there are quite a few records, seems 55 users have similar issue, we probably need to talk about what is best way to handle it.

@rebekahperillo just confirm with you first, for a user that have quick succession submissions, should we remove all the other and only leave the latest record, please see below screen shot, the red highlight is the latest for 3 submission in a row. and are we only check records that have second difference.

image
rebekahperillo commented 11 months ago

@weiwang-gsa Per our talk earlier today, it makes sense to clean up the data errors that were a result of this bug. So, if there are instances where a user has quiz results in very quick succession due to the bug, let's keep the latest record. If you have any further questions, feel free to reach out again. Thank you!

weiwang-gsa commented 11 months ago

@rebekahperillo Here is the users has multiple quiz submissions, yellow highlights are those records that what I plan to remove ( less than 1 minutes), red highlights are the ones I have questions and need your confirmation, those are records that are less than 1 hours, some are a few minutes difference. we can discuss it tomorrow.

rebekahperillo commented 11 months ago

@weiwang-gsa Thanks, Wei. I'll take a look and we'll talk tomorrow.

weiwang-gsa commented 11 months ago

@rebekahperillo per our discussion below decisions are made, and it is ready for your review on staging: https://federalist-2e11f2c8-970f-44f5-acc8-b47ef6c741ad.sites.pages.cloud.gov/preview/gsa/smartpay-training/staging/

  1. Only remove those quiz completions that has seconds difference ( <1 minutes) and leave those user multiple quiz completions that are minutes, hours difference untouched.
  2. based on 1, for those records that minutes and hours difference within the same day are still in DB, and you can see there are many records like that, it will show up in quiz completion report as duplications as current report display "Quiz Completion Date" not timestamp. Thus, the decision is change "Quiz Completion Date" to "Quiz Completion Date and Time" to show timestamp instead as a way to distinguish these records are not duplicates, but user completed multiple times within the same day.
  3. Added spinner for visual cue that submission is in process
rebekahperillo commented 11 months ago

@weiwang-gsa Great work again! Moving to DONE. Thank you!

weiwang-gsa commented 11 months ago

@rebekahperillo please confirm if you are ok to deploy this to production today?

rebekahperillo commented 11 months ago

@weiwang-gsa Yes, that works.

weiwang-gsa commented 11 months ago

@rebekahperillo the bug fix is released on production.

rebekahperillo commented 11 months ago

Looks great! Moving to closed. Thank you, @weiwang-gsa!