VictorAZ12 / web-request-forum

0 stars 0 forks source link

Model design update #42

Closed VictorAZ12 closed 4 months ago

VictorAZ12 commented 4 months ago

Instead of using goals, rewrite models so that the challenges can be made from habits and can be turned into habits of users as per user's choice, and a habit is a repeating task for a user.

22321855 commented 4 months ago

Attributes for Habits: • habit_name: A user-input field where users can specify the name of their habit. This allows for personalization while keeping the habit type standardized. • habit_type: This should be a list of options for users to choose from. Standardizing the habit names ensures consistency within the system and simplifies tracking and reporting. • habit_goal: This is an integer starting from 1. The habit goal, combined with the habit unit, defines a measurable and meaningful goal. • habit_unit: Units such as times, ml (milliliters), or minutes. The unit is selected based on the chosen habit. For example, if the habit is "Drink water," the unit will be ml; if the habit is "Do push-ups," the unit will be times. • habit_frequency: Specifies how often the habit should be performed, such as per day, per week, or per month. • start_date: The date the habit starts. Front-end validation ensures that users cannot select a past date. Attributes for Tracking Habit Records: • habit_status: Indicates whether the habit is complete or failed. The status should be recorded based on the habit_frequency. For example, if the habit_frequency is per day, the system should keep daily records of the habit_status for that specific goal. This structure will help in effectively managing and tracking habits within the system, ensuring that each aspect of the habit and its progress is accurately recorded and monitored.

22321855 commented 4 months ago

Also a demo list of Habit_type and Habit_unit: • Walking - minutes • Running - minutes • Reading - pages • Meditating - minutes • Drinking Water - milliliters (ml) • Exercise - times • Writing - words • Sleeping - hours • Studying - hours • Cycling - kilometers

VictorAZ12 commented 4 months ago

In this case, habit_type would be a separate table to store types of habits. Also we need a table to store user check-ins. As for the habit_status, it should be a method that computes the status on the fly. For example, to check the status of a user's habit, get current date/week/month, and select all check-ins of this habit from this user within that date/week/month, then compare the number of rows with the configured habit_goal value.

VictorAZ12 commented 4 months ago

models.py updated, this will be automatically closed after the commit 0e87da4 is merged into main branch