add day rating feature

This commit is contained in:
2024-03-12 19:14:29 +01:00
parent 2d923df965
commit 0cdc359463
6 changed files with 80 additions and 46 deletions

View File

@@ -10,6 +10,14 @@ ID_MAPPINGS = {
}
ID_MAPPINGS_REV = dict((v, k) for k, v in ID_MAPPINGS.items())
RATING_MAPPING = {
1: "😵",
2: "☹️",
3: "😐",
4: "😃",
5: "🥰"
}
MEDIA_DIR = Path(os.getenv("MEDIA_DIR"))
MEDIA_DIR.mkdir(parents=True, exist_ok=True)
@@ -28,7 +36,7 @@ class JournalEntry(BaseModel):
text = TextField(null=True)
media_path = TextField(null=True)
last_shown = DateField(null=True)
rating = IntegerField(null=True) # mapped by RATING_MAPPING
@property
def media(self):
@@ -69,7 +77,7 @@ class JournalEntry(BaseModel):
"("
"(((?<=(\.|\!|\?)\s)[A-Z])|(^[A-Z]))" # beginning of a sentence
"([^\.\!\?])+" # any character being part of a sentence
"((\:\))|😇|😈)" # the smiley
"((\:\))|😇|😈|[Ss]ex)" # the smiley
"([^\.\!\?])*" # continuation of sentence
"(\.|\!|\?|\,|$)" # end of the sentence
")"