Need help figuring out the best way to store/save this data

Wappler is maybe not the best tool to be attempting this in, but I find messing around with fun projects is the best way to learn. Sorry if this doesn’t belong in this topic due to it not being strictly about Wappler.

I am trying to make a website similar to https://2kdb.net/drafts/new/23
where you get some random cards that have a point value and you select which to keep.

I have something working now that when you hit a button on the page it creates a database entry in a table called “game”. Then there is a button to draw a card, which randomly takes a card out of a “card” table and shows it on the screen. You can either skip it and draw a new card or save it. If you save it, it saves to the “game” entry which was created earlier. There is a limit to the number of cards you can draw which goes down by 1 every time you draw a new card.

I want to make sure users are not able to enter a ton of entries into the database of unfinished games. My first thought is not save anything to the database until the user has drawn all of the cards and hits a save button, but I don’t know how I would store which cards they picked. I saw Creating a Shopping Cart with the Data Store Component and was wondering if that is a possible solution, but I had planned to have a high score type system and I believe it is possible for a user to edit data stored it sessions so they would be able to “cheat”.

Another option would be to delete any “game” entries that were not finished, but I don’t know the best way to accomplish that. Maybe schedule an event that runs once a day to delete the entries?

Finally, I could limit how often a user can play. I thought maybe using session data I could have it show their last game if it was unfinished or mark when they last played and have a condition where if they have played in the last x minutes they can’t make a new game.

If anyone has any advice on the best way to go about this it would be much appreciated!

Community Page
Last updated: