How to implement daily voting on items?

Hello I am new to Bubble and I am trying to implement an idea of a daily voting app. I am struggling to find the best way to handle the Data (and the workflows)

  • I want users to be able to vote (up or down) on an item
  • Each user can vote only once a day for the same item
  • The result of the day is stored (and available to use on a chart)
  • The next day users can vote again…etc.

The idea is to be able to display the daily results as well as a trend chart.

Is that doable with Bubble?

Thanks in advance

Yes its doable, you can limit the votes for example (it occurs to me without thinking too much) filtering each user on the db with yes/no filter.
Also create something like a dashboard where the results appears with a charts and + stuff.

My recomendation is do all the lessons, and search some finished projects and investigate the code (at first looks hard as hell) But its really easy to understand. ^^


Yes, it’s doable. Not simple, but not crazy hard either. For example, here’s one way to do it:

  • Create the UI
  • When users vote, then run a workflow to store that in the Database.
  • Have a condition to only store that in the DB if it’s their first vote of the day. Way to do this is check if there was a value in that table created during the same day.
  • To calculate daily values, you could just do the math on the calculations each time. If page load speed matters, then I’d recommend storing the daily totals each day and then just loading that data into charts (so it doesn’t need to get recalculated each time). The way to do this is to set up a cron job (Bubble calls them Daily triggers or something else like that I believe) and have it run each night at midnight and calculate the totals for the day and store them in a table.
  • To see daily results, just display the values you stored for daily totals.

That should do it.

One item / assumption to highlight. This approach assumes that you’re doing a daily option that uses one specific time zone for the end of the day and not custom for each user’s actual time zone. The latter is possible as well, I’m sure, but would be materially more complicated to implement.