dedis / popstellar

Proof-of-personhood System
GNU Affero General Public License v3.0
35 stars 8 forks source link

[BUG] Scanning Attendee Spams Toast #1925

Open Kaz-ookid opened 2 months ago

Kaz-ookid commented 2 months ago

Description

As an organizer on a FE2 device, when scanning attendees we get a first successful toast, and get afterward 10s of error toasts "Attendee already scanned".

Expected behavior

A successful scan should not be followed directly by failed scan, and let the user the chance to turn the camera away from this scanned QR code before infinitely trying to scan it again.

How to reproduce

  1. Create a LAO, Join it with another device, create a RollCall
  2. Scan the second device with the organizer device and quickly turn the camera away (to not get too much toasts queuing)
  3. See the Successful Toast for a few seconds
  4. See the infinitely succeeding error "Attendee already scanned"
Front-ends:
Back-ends:

Impact

Decent user experience impact, as it is a commonly used feature. If an organizer wants to scan multiple people at a time, won't be able to see if the scans are successful as the app is spammed with error toasts from the previously scanned QRs.

Possible root cause

The program trying to scan a lot of times per second, thus successfully scanning on the first attempt and failing on the next ones. The user does not have the time to pull away from the QR before queuing a lot of error toasts.

Possible solution

Have a filter list of recently scanned tokens, where those tokens are remove from the list after 2 or 3 seconds. When scanning a QR (regardless to if its scanned already or not), if it is in the list : do nothing, else : add it to the list.

Easy way could be the list to be a list of mappings: token -> timestamp of scanning. If current time - timestamp is greater than a given time, remove it from the list.