Open SweetByte13 opened 3 months ago
Need to create helper function that does the 'sync' functionality
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.
Get All by user id Place in /controllers/habits.py