SweetByte13 / Diem

Habit Tracker
1 stars 0 forks source link

Create: Get Habits By User Id Route #6

Open SweetByte13 opened 3 months ago

SweetByte13 commented 3 months ago

Get All by user id Place in /controllers/habits.py

zbb272 commented 2 months ago

Need to create helper function that does the 'sync' functionality

zbb272 commented 1 month ago

adding comment from other ticket to add extra details on process:

when user logins succesfully, the app makes a request to backend endpoint to refresh/update habit instances. The backend then checks either: last habit occurance due_date, or if no previous occurrences exist the create date of the habit. and uses it as the start date. The backend then uses the start date and recurrence pattern to generate all HabitOccurances up to the Current DateTime.

The UI should display previous HabitOccurances based on the instances returned from the backend, future occurances based on the recurrence pattern.

no HabitOccurances will exist for future dates, the HabitOccurances will generated dayOf on login or generated for previous dates. users cannot mark future occurances complete anyway This is for 2 reasons: it prevents the need for a service to run that will calculate a certain amount of future dates every day. This will only generate saved data for active users, and inactive users will not have HabitOccurances generated.