qccoders / startup-idea-generator

Click a button and receive a randomized startup idea!
http://startups.qccoders.org
GNU General Public License v3.0
5 stars 7 forks source link

Add the ability to 'react' to generated ideas #46

Open jpdillingham opened 5 years ago

jpdillingham commented 5 years ago

Add icons to the screen which allow users to 'react' to an idea; this might be similar to Reddit's up/downvotes, Facebook's reactions, or something entirely new.

This will require that a back-end API is reintroduced so that pairings and reactions can be persisted.

Reactions should be limited to one per person, perhaps using cookies or persisting a browser thumbprint. It shouldn't be necessary to require authentication.

mtliendo commented 5 years ago

With both nouns and startups being generated randomly, what is the likeliness that another user will get the same pair?

Suggestion

Having this option appear only for authenticated users and scoped to their profile. That way it can serve as a bookmark of sorts for ideas.

jpdillingham commented 5 years ago

I'd be ok with storing votes/reactions per user but would be concerned about the complexity in tallying reactions to each pairing when fetching. You could realistically do both; add individual user votes and at the same time increment/decrement the pairing record to enable fast lookups. There's always the chance that the two could become disconnected though, so you'd want to look into the ability to update records inside of a transaction on the back end.

I see what you're saying about conflicts though, so one way that could be solved for would be to only send an id along with the pairing if there is an existing record. If a user does something that would cause the pairing to be added to the database, that API call would first check the database for an existing record (jn case one was added between the time when the user fetched the pairing and when they took the action) and if one exists, return that id, otherwise create the record with a randomized id and return that.