Skip to content

Commit 84576fa

Browse files
committed
In the "Tasks" module, I have made the following changes:
Now the "Register" class can also register a task's progress, and not just a full task. This way, the user can register their progress on tasks in the current Diary Slim without needing to register a task. I did this by creating a new state called "Register task" that can be changed by the "Diary Slim" module. This state determines if the task will be registered in the database of productive things done (Task History). Or if the task will only be registered in the current Diary Slim, with the class writing the task description there. The task types can also use different task titles for the task progress. For example, the normal title of the Python task type is: "I programmed in Python a lot, programming my module [X]". And the title for the task progress is: "I have been programming my modules in Python until now". I also updated how the root method "Show_Information" shows information about the registered task to the user when it is a task progress. Changing "This task was registered" to "The progress of this task was registered", and changing other texts to talk about the task progress rather than the task itself. In the "Diary_Slim", in the "Write_On_Diary_Slim" class, I have made the following changes: I added the "Register task" state to the task dictionary (when the selected text is also a task). After defining the task dictionary with that state, the class asks if the user wants to register the full task or just the progress of the task. If the user wants to register only the progress of the task, then the "Register task" key will be set to False (No). I also changed various conditions throughout the class to check if the task was registered or not. If the text is also a task and has a statistic, even if the task was or was not registered, the root number of the statistic will go up by one. But the statistic questions will only be asked if the task was registered, not if it is just a task progress. For example, in the Python task type, the statistic "Times programmed in Python" will go up by one even if a task progress is registered. And in the PHP task type, the statistic "Times programmed in PHP, HTML, CSS, and JavaScript" will also go up by one, but the sub-statistic "New websites created" will not. This is because this sub-statistic depends on a question, and questions are only asked when full tasks are registered, not just a task progress.
1 parent 032eaaa commit 84576fa

File tree

15 files changed

+425
-105
lines changed

15 files changed

+425
-105
lines changed

Module files/Diary_Slim/Texts.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,5 +98,21 @@
9898
"type_how_many_times_you_rode_your_bike": {
9999
"en": "Type how many times you rode your bike",
100100
"pt": "Digite quantas vezes você andou de bicicleta"
101+
},
102+
"register_the_task": {
103+
"en": "Register the task",
104+
"pt": "Registrar a tarefa"
105+
},
106+
"register_the_task_progress": {
107+
"en": "Register the task progress",
108+
"pt": "Registrar o progresso da tarefa"
109+
},
110+
"list_of_actions": {
111+
"en": "List of actions",
112+
"pt": "Lista de ações"
113+
},
114+
"choose_the_action": {
115+
"en": "Choose the action",
116+
"pt": "Escolha a ação"
101117
}
102118
}

Module files/Food_Time/Times.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
"Will be hungry": 3
1111
},
1212
"Ate": {
13-
"Object": "2025-01-22 16:58:16-03:00",
13+
"Object": "2025-01-29 13:42:05-03:00",
1414
"Time": 0,
15-
"Time text": "16:58",
15+
"Time text": "13:42",
1616
"Unit": {
1717
"en": "hours",
1818
"pt": "horas"
@@ -23,9 +23,9 @@
2323
}
2424
},
2525
"Can drink water": {
26-
"Object": "2025-01-22 17:38:16-03:00",
26+
"Object": "2025-01-29 14:22:05-03:00",
2727
"Time": 40,
28-
"Time text": "17:38",
28+
"Time text": "14:22",
2929
"Unit": {
3030
"en": "minutes",
3131
"pt": "minutos"
@@ -36,9 +36,9 @@
3636
}
3737
},
3838
"Will be hungry": {
39-
"Object": "2025-01-22 19:58:16-03:00",
39+
"Object": "2025-01-29 16:42:05-03:00",
4040
"Time": 3,
41-
"Time text": "19:58",
41+
"Time text": "16:42",
4242
"Unit": {
4343
"en": "hours",
4444
"pt": "horas"

Module files/Social_Networks/Texts.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,5 +121,13 @@
121121
"you_can_use_the_{}_format_string_to_place_the_social_network_link, type: explanation": {
122122
"pt": "Você pode usar a string de formato {} para colocar o link da rede social.\nE a string de formato {} para colocar o item, trocando o [Item] por qualquer item que você selecionou (em Inglês).",
123123
"en": "You can use the {} format string to place the social network link.\nAnd the {} format string to place the item, replacing the [Item] with any item you selected."
124+
},
125+
"conversations_link": {
126+
"pt": "Link de conversas",
127+
"en": "Conversations link"
128+
},
129+
"conversations_link, type: plural": {
130+
"pt": "Links de conversas",
131+
"en": "Conversations links"
124132
}
125133
}

Module files/Stories/Texts.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,10 @@
277277
"en": "I have been {} the chapter {} of my story \"{}\" until now",
278278
"pt": "Eu estive {} o capítulo {} da minha história \"{}\" até agora"
279279
},
280+
"i_{}_the_chapter_{}_of_my_story_{}": {
281+
"en": "I {} the chapter {} of my story \"{}\"",
282+
"pt": "Eu {} o capítulo {} da minha história \"{}\""
283+
},
280284
"i_finished_{}_the_chapter_{}_of_my_story_{}": {
281285
"en": "I finished {} the chapter {} of my story \"{}\"",
282286
"pt": "Eu terminei de {} o capítulo {} da minha história \"{}\""

Module files/Tasks/Texts.json

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@
4747
"en": "This task was registered",
4848
"pt": "Esta tarefa foi registrada"
4949
},
50+
"the_progress_of_this_task_was_registered": {
51+
"en": "The progress of this task was registered",
52+
"pt": "O progresso desta tarefa foi registrado"
53+
},
5054
"select_a_task_type": {
5155
"en": "Select a task type",
5256
"pt": "Selecione um tipo de tarefa"
@@ -71,6 +75,18 @@
7175
"en": "Task description in",
7276
"pt": "Descrição da tarefa em"
7377
},
78+
"the_task_description": {
79+
"en": "The task description",
80+
"pt": "A descrição da tarefa"
81+
},
82+
"the_task_progress": {
83+
"en": "The task progress",
84+
"pt": "O progresso da tarefa"
85+
},
86+
"text_of_the_task_progress_in": {
87+
"en": "Text of the task progress in",
88+
"pt": "Texto do progresso da tarefa em"
89+
},
7490
"task_text_template": {
7591
"en": "Number: {}\nTask type number: {}\nType: {}\nTime: {}\nFile name: {}",
7692
"pt": "Número: {}\nNúmero de tipo de tarefa: {}\nTipo: {}\nTempo: {}\nNome de arquivo: {}"
@@ -119,9 +135,13 @@
119135
"pt": "Pressione Enter quando você terminar de escrever e salvar a descrição em {}",
120136
"en": "Press Enter when you finish writing and saving the description in {}"
121137
},
122-
"the_task_description_was_written_on_the_current_diary_slim": {
123-
"en": "The task description was written on the current Diary Slim",
124-
"pt": "A descrição da tarefa foi escrita no Diário Slim atual"
138+
"{}_was_written_on_the_current_diary_slim, gender: masculine": {
139+
"en": "{} was written on the current Diary Slim",
140+
"pt": "{} foi escrito no Diário Slim atual"
141+
},
142+
"{}_was_written_on_the_current_diary_slim, gender: feminine": {
143+
"en": "{} was written on the current Diary Slim",
144+
"pt": "{} foi escrita no Diário Slim atual"
125145
},
126146
"select_the_drawing_program": {
127147
"en": "Select the drawing program",

Module files/Utility/Language/Texts.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,10 @@
7070
"en": "With file",
7171
"pt": "Com arquivo"
7272
},
73+
"archive, title()": {
74+
"en": "Archive",
75+
"pt": "Arquivo"
76+
},
7377
"created": {
7478
"en": "created",
7579
"pt": {
@@ -2181,6 +2185,10 @@
21812185
"en": "My",
21822186
"pt": "Meu/Minha"
21832187
},
2188+
"family, title()": {
2189+
"en": "Family",
2190+
"pt": "Família"
2191+
},
21842192
"siblings, title()": {
21852193
"en": "Siblings",
21862194
"pt": "Irmãos"

Modules/Diary_Slim/Diary_Slim/__init__.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1051,6 +1051,14 @@ def Define_Statistics(self):
10511051

10521052
# ----- #
10531053

1054+
# If the "Secondary statistics" key is inside the statistics dictionary
1055+
if "Secondary statistics" in statistic:
1056+
# Add each one of the items of the dictionary to the statistics template
1057+
for item in statistic["Secondary statistics"]:
1058+
self.statistics_template[key][item] = 0
1059+
1060+
# ----- #
1061+
10541062
# Switch the "Is statistic" state to True
10551063
dictionary["Is statistic"] = True
10561064

Modules/Diary_Slim/Write_On_Diary_Slim/__init__.py

Lines changed: 135 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,15 @@ def __init__(self):
4444
# Run the method to manage statistics
4545
self.Manage_Statistic()
4646

47+
# If the "Is task" key is inside the text dictionary
48+
# And the task was not registered
49+
if (
50+
"Is task" in self.dictionary["Text"] and
51+
self.task_dictionary["Register task"] == False
52+
):
53+
# Define the "Input on end" state as True
54+
self.states["Input on end"] = False
55+
4756
# Write the Diary Slim text
4857
self.Write()
4958

@@ -61,7 +70,6 @@ def Select_The_Text(self):
6170
}
6271

6372
# Change the index of the Diary Slim texts dictionary if the text has a custom index
64-
t = 0
6573
for key in self.diary_slim["Texts"]["Options"]["Keys"]:
6674
# Get the text dictionary
6775
dictionary = self.diary_slim["Texts"]["Dictionary"][key]
@@ -543,9 +551,36 @@ def Register_Task(self):
543551
"Type": self.dictionary["Text"]["Key"],
544552
"Entry": {
545553
"Date": self.Date.Now()
546-
}
554+
},
555+
"Register task": True
547556
}
548557

558+
# If the "Has task progress" key is inside the text dictionary
559+
if "Has task progress" in self.dictionary["Text"]:
560+
# Define the list of options
561+
options = [
562+
"Register task",
563+
"Register task progress"
564+
]
565+
566+
# Define the list of language options
567+
language_options = [
568+
self.language_texts["register_the_task"],
569+
self.language_texts["register_the_task_progress"]
570+
]
571+
572+
# Define the show and select text
573+
show_text = self.language_texts["list_of_actions"]
574+
select_text = self.language_texts["choose_the_action"]
575+
576+
# Ask if the user wants to register the task progress
577+
response = self.Input.Select(options, language_options = language_options, show_text = show_text, select_text = select_text)["Option"]["Original"]
578+
579+
# If the answer is "Register task progress"
580+
if response == "Register task progress":
581+
# Change the "Register task" state to False
582+
self.task_dictionary["Register task"] = False
583+
549584
# Import the "Register" class of the "Tasks" module
550585
from Tasks.Register import Register as Register
551586

@@ -565,17 +600,24 @@ def Manage_Statistic(self):
565600
# Define the questions dictionary
566601
questions = statistic
567602

568-
# Iterate through the list of question keys inside the list above
569-
for question_key in self.dictionary["Question keys"]:
570-
# If the key is inside the statistic dictionary
571-
if question_key in self.dictionary["Text"]["Statistic"]:
572-
# Get the additional information about the statistic, passing the "Is statistic" parameter as True
573-
information = self.Get_Additional_Information(self.dictionary["Text"], is_statistic = True)
603+
# If the "Is task" key is not inside the text dictionary
604+
# Or it is, and the task was registered
605+
if (
606+
"Is task" not in self.dictionary["Text"] and
607+
"Is task" in self.dictionary["Text"] or
608+
self.task_dictionary["Register task"] == True
609+
):
610+
# Iterate through the list of question keys inside the list above
611+
for question_key in self.dictionary["Question keys"]:
612+
# If the key is inside the statistic dictionary
613+
if question_key in self.dictionary["Text"]["Statistic"]:
614+
# Get the additional information about the statistic, passing the "Is statistic" parameter as True
615+
information = self.Get_Additional_Information(self.dictionary["Text"], is_statistic = True)
574616

575-
# Define the text to write, questions, and "Has questions" state using the values inside the local information dictionary
576-
self.dictionary["Text to write"] = information["Text to write"]
577-
questions = information["Questions"]
578-
statistic["Has questions"] = information["Has questions"]
617+
# Define the text to write, questions, and "Has questions" state using the values inside the local information dictionary
618+
self.dictionary["Text to write"] = information["Text to write"]
619+
questions = information["Questions"]
620+
statistic["Has questions"] = information["Has questions"]
579621

580622
# Get the statistic dictionary of the Diary Slim text, in the current year
581623
current_year_statistics = self.diary_slim["Current year"]["Statistics"][text_key]
@@ -603,9 +645,9 @@ def Manage_Statistic(self):
603645
# Get the text from it
604646
statistic_text = self.dictionary["Text"]["Data"][self.user_language]
605647

606-
# If the "Alternative text" is inside the statistic dictionary
607-
if "Alternative text" in statistic:
608-
statistic_text = statistic["Alternative text"][self.user_language]
648+
# If the "Text" key is inside the statistic dictionary
649+
if "Text" in statistic:
650+
statistic_text = statistic["Text"][self.user_language]
609651

610652
# ---------- #
611653

@@ -714,6 +756,45 @@ def Manage_Statistic(self):
714756
# Define the number as zero
715757
number = 0
716758

759+
# If the "Key" key is inside the question dictionary
760+
if "Key" in question:
761+
# Define the local text key
762+
local_text_key = question["Key"].replace(" ", "_").lower()
763+
764+
# Define the old number
765+
old_number = current_year_statistics[question["Key"]]
766+
767+
# Define the number to add as the response number
768+
number_to_add = number
769+
770+
# Add the additional question key to the root statistics dictionary
771+
self.dictionary["Text"]["Statistics"]["Dictionary"][question["Key"]] = {
772+
"Text": self.Language.language_texts[local_text_key],
773+
"Old number": old_number,
774+
"Number": old_number + number_to_add
775+
}
776+
777+
# Update the number in the month statistic key
778+
current_year_statistics[question["Key"]] = self.dictionary["Text"]["Statistics"]["Dictionary"][question["Key"]]["Number"]
779+
780+
# ----- #
781+
782+
# Define the old number
783+
old_number = current_month_statistics[question["Key"]]
784+
785+
# Add the additional question key to the month statistics dictionary
786+
self.dictionary["Text"]["Statistics"]["Month"]["Dictionary"][question["Key"]] = {
787+
"Text": self.Language.language_texts[local_text_key],
788+
"Old number": old_number,
789+
"Number": old_number + number_to_add
790+
}
791+
792+
# Update the number in the month statistic key
793+
current_month_statistics[question["Key"]] = self.dictionary["Text"]["Statistics"]["Month"]["Dictionary"][question["Key"]]["Number"]
794+
795+
# Define the number as one
796+
number = 1
797+
717798
# If the "Questions" key is inside the statistic dictionary
718799
if "Questions" in statistic:
719800
# If the "Create sub-dictionary" key is inside the question dictionary
@@ -890,6 +971,38 @@ def Manage_Statistic(self):
890971
# Format the text with the list of items, updating the text to write
891972
self.dictionary["Text to write"] = self.Language.language_texts[format_text].format(*items)
892973

974+
# If the "Secondary statistics" key is inside the statistic dictionary
975+
if "Secondary statistics" in statistic:
976+
# Iterate through the keys and statistic dictionaries on the "Secondary statistics" dictionary
977+
for key, local_statistic in statistic["Secondary statistics"].items():
978+
# Get the current number of the current year
979+
current_number = current_year_statistics[key]
980+
981+
# Add the additional question key to the month statistics dictionary
982+
local_statistic = {
983+
"Text": local_statistic["Text"][self.user_language],
984+
"Old number": current_number,
985+
"Number": current_number + 1
986+
}
987+
988+
# Add the statistic dictionary to the current year statistics dictionaries
989+
self.dictionary["Text"]["Statistics"]["Dictionary"][key] = local_statistic
990+
991+
# ----- #
992+
993+
# Get the current number of the current year
994+
current_number = current_year_statistics[key]
995+
996+
# Add the additional question key to the month statistics dictionary
997+
local_statistic = {
998+
"Text": local_statistic["Text"][self.user_language],
999+
"Old number": current_number,
1000+
"Number": current_number + 1
1001+
}
1002+
1003+
# Add the statistic dictionary to the current year and current month statistics dictionaries
1004+
self.dictionary["Text"]["Statistics"]["Month"]["Dictionary"][key] = local_statistic
1005+
8931006
# Update the number of statistics in the current year
8941007
self.dictionary["Text"]["Statistics"]["Number"] = len(list(self.dictionary["Text"]["Statistics"]["Dictionary"].keys()))
8951008

@@ -1065,7 +1178,11 @@ def Write(self):
10651178
Write_On_Diary_Slim_Module(dictionary)
10661179

10671180
# If the "Is task" key is inside the text dictionary
1068-
if "Is task" in self.dictionary["Text"]:
1181+
# And the task was registered
1182+
if (
1183+
"Is task" in self.dictionary["Text"] and
1184+
self.task_dictionary["Register task"] == True
1185+
):
10691186
# Show a five dash space separator
10701187
print()
10711188
print(self.separators["5"])
@@ -1078,9 +1195,11 @@ def Write(self):
10781195
print("\t" + self.language_texts["Diary_Slim.Write"])
10791196

10801197
# If the "Is statistic" state is True
1198+
# And the "Statistics" key is inside the Diary Slim text dictionary
10811199
# And the "Changed statistic" is True
10821200
if (
10831201
self.dictionary["Text"]["Is statistic"] == True and
1202+
"Statistics" in self.dictionary["Text"] and
10841203
self.dictionary["Text"]["Statistics"]["Changed statistic"] == True
10851204
):
10861205
# Iterate through the list of date types

0 commit comments

Comments
 (0)