You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
850 B
34 lines
850 B
from typing import Optional
|
|
from dataclasses import dataclass
|
|
from uuid import uuid4
|
|
|
|
# A loop Habit representation.
|
|
# Tracks anything whose value can be encapsulated in a numerical value.
|
|
@dataclass
|
|
class Habit:
|
|
name: str
|
|
type: int = 0 # 1 is range counter
|
|
archived: int = 0
|
|
color: int = 0
|
|
highlight: int = 0
|
|
freq_den: int = 1
|
|
freq_num: int = 1
|
|
target_value: int = 0
|
|
description: str = ""
|
|
question: str = ""
|
|
unit: str = ""
|
|
position: int = 0
|
|
uuid: str = ""
|
|
|
|
def __post_init__(self):
|
|
if not self.uuid or self.uuid == "":
|
|
self.uuid = uuid4().hex
|
|
|
|
|
|
# A Loop repetition representation, containing only the bare minimum
|
|
# for its successful entry into the Loop Habit Tracker database.
|
|
@dataclass
|
|
class Repetition:
|
|
habit_uuid: str
|
|
timestamp: int
|
|
value: Optional[int]
|
|
|