I am making a meditation app. My app is considered to calculate overall time (minutes) spent by a user on a meditation practice (there are several types of meditation practice). After each practice of a certain type, the user enters how many minutes this practice lasted.
Now my algorithm works in such a way that every time the user taps the button in app, another row is added (containing user id, date and time from the system and the number of minutes spent on practice of certain type, where number of minutes is a value that is chosen by the user from a pre-formed list of fixed values).
To calculate stats I need a user id and short date with out time.
I wish to decrease rows. I want to use algorithm where every new row is added only if the user ID and date does not exist in database before.
Another case (id and date is in the base), it is the data âminutes spent on practice Xâ that should be overwritten. Other user data (ID, practice type) should stay untouched.
Tell me which algorithm is better to use. So I try to make ÂŤone button/tapÂť experience for friends. I would really appreciate your help.
Iâm making an assumption that youâre trying to optimize a meditation appâs data storage to reduce redundant entries when users log practice times, and each user should have one entry per practice type, updating minutes if the entry already exists.
You have 2 ways to go here.
If you donât need admins or other users to view a personâs logs, you can use the new stopwatch component, point it to a user-specific column, and it will work just like that.