CodingTrain / thecodingtrain.com

All aboard the Coding Train! Choo choo! 🚂🌈❤️
https://thecodingtrain.com
MIT License
189 stars 107 forks source link

Prevent Duplicate Showcase Submissions #1550

Open dipamsen opened 3 months ago

dipamsen commented 3 months ago

Maybe we could add something like "will be reviewed within [timeframe]" or "Please do not submit twice" to prevent duplicate submissions.

Another idea could be to link to /pulls so that the user can be convinced that the pr has been created

fturmel commented 2 months ago

@dipamsen There has been a lot of dupes lately.

I agree the messaging could be improved (it's currently "Thank you for submitting to the Passenger Showcase! Please refresh the page in order to upload another submission."), but I think it could be an implementation issue on our end.

Look at #1588 and #1589 for example, the submittedOn server timestamps are about 1 second apart. That's too short for a user to fill the form again and re-submit.

At a glance, one possible reason would be because there's an onClick handle on the submit button AND an onSubmit on the form. The submit button should be of type "submit" and not have a click handler. Maybe in some cases both the click and form submit fire at the same time.

https://github.com/CodingTrain/thecodingtrain.com/blob/eb0535a049e9968d5a3fc53f5ecb79d48f673b52/src/components/PassengerShowcaseForm.js#L225

https://github.com/CodingTrain/thecodingtrain.com/blob/eb0535a049e9968d5a3fc53f5ecb79d48f673b52/src/components/PassengerShowcaseForm.js#L428-L435

fturmel commented 2 months ago

The submitted state is also only updated once the response comes back from the API call. We might need a waiting interim state to disable the form/button and some visual indicator that the request is being processed. The dupes could simply be caused by double-clicks.

shiffman commented 2 months ago

Also, it might be nice to add something more unique (beyond just a reference to the video) to the pull request subject, this will make it easier for me to recognize dupes?

fturmel commented 2 months ago

Cool, I can take a stab at this. I have some additional ideas on how to improve the form experience as well. We can fine-tune and discuss the specifics in the pull request.

kfahn22 commented 2 months ago

I am also wondering if there is an issue with pull requests disappearing. I didn't notice until just now, but I submitted two for marbling and there is no record of the second one.

fturmel commented 2 months ago

I am also wondering if there is an issue with pull requests disappearing. I didn't notice until just now, but I submitted two for marbling and there is no record of the second one.

Can you share more details? Was it through the Coding Train web form? Were they submitted the same day? Does it go through if you try again with the same image/info?

I checked the Netlify functions log history and I could see the one from May 2nd that got merged but not the other. The logs only go back a week though.

It's not impossible for a web form submission to fail silently. Part of the process is handled by a background function that runs after we send the confirmation back to the user. It's a bit of a black hole if anything ends up going wrong during that step.

Are we aware of other users reporting similar problems?

kfahn22 commented 2 months ago

I submitted two at the same time through the web form. My memory is that I got a confirmation that the second had been submitted, but I suppose it is possible (or perhaps probable since there is no record of it?) that I am mistaken. (I didn't check to see whether the pull requests had been created. I didn't realize the second was missing until I looked at the Passenger Showcase to decide the next round of featured showcases.)

The duplicate pull requests are puzzling. @shiffman How would you feel about sending out a notice to everyone in the Discord server asking if they have had any difficulties submitting a showcase, and if so, the nature of the problem?