Skip to content

Commit 38f4c55

Browse files
committed
Added issue templates, fixed errors on the Diary_Slim module, and updated README
1 parent 8f08613 commit 38f4c55

File tree

7 files changed

+186
-71
lines changed

7 files changed

+186
-71
lines changed

.github/ISSUE_TEMPLATE/enhancement.md

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
name: Enhancement
3+
about: Use this template to suggest and enhancement of a module or Python script
4+
title: "Enhancement: "
5+
labels: Enhancement
6+
assignees: Stake2
7+
---
8+
9+
Enhancement:
10+
11+
12+
Description:
13+
14+
15+
Module title:
16+
17+
18+
Comments:

.github/ISSUE_TEMPLATE/error.md

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
name: Error
3+
about: Use this template to report errors on modules and Python scripts
4+
title: "Error: "
5+
labels: Error
6+
assignees: Stake2
7+
---
8+
9+
Error:
10+
11+
12+
Screenshot of error:
13+
14+
15+
Comments:

.github/ISSUE_TEMPLATE/question.md

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
name: Question
3+
about: Use this template to ask questions to the author of this repository
4+
title: "Question: "
5+
labels: Question
6+
assignees: Stake2
7+
---
8+
9+
Question:
10+
11+
12+
Comments:

Module Files/Food_Time/Times.json

+6-6
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
"Will be hungry": 3
1111
},
1212
"Ate": {
13-
"Object": "2023-06-03 14:13:45-03:00",
13+
"Object": "2023-06-04 03:15:50-03:00",
1414
"Time": 0,
15-
"Time text": "14:13",
15+
"Time text": "03:15",
1616
"Unit": {
1717
"en": "hours",
1818
"pt": "horas"
@@ -23,9 +23,9 @@
2323
}
2424
},
2525
"Can drink water": {
26-
"Object": "2023-06-03 14:53:45-03:00",
26+
"Object": "2023-06-04 03:55:50-03:00",
2727
"Time": 40,
28-
"Time text": "14:53",
28+
"Time text": "03:55",
2929
"Unit": {
3030
"en": "minutes",
3131
"pt": "minutos"
@@ -36,9 +36,9 @@
3636
}
3737
},
3838
"Will be hungry": {
39-
"Object": "2023-06-03 17:13:45-03:00",
39+
"Object": "2023-06-04 06:15:50-03:00",
4040
"Time": 3,
41-
"Time text": "17:13",
41+
"Time text": "06:15",
4242
"Unit": {
4343
"en": "hours",
4444
"pt": "horas"

Modules/Diary_Slim/Create_New_Diary_Slim/__init__.py

+113-62
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,10 @@ def __init__(self, dictionary = {}):
2626
if "Check" in self.dictionary:
2727
text = self.language_texts["skipped_diary_slim_day"]
2828

29+
units = self.dictionary["Date"]["Timezone"]["DateTime"]["Units"]
30+
2931
self.today_is_text = text + ":" + "\n" + \
30-
self.day_of_of_text.replace("Dia ", "").format(self.dictionary["Date"]["Units"]["Day"], self.dictionary["Date"]["Texts"]["Month name"][self.user_language], self.dictionary["Date"]["Units"]["Year"])
32+
self.day_of_of_text.replace("Dia ", "").format(units["Day"], self.dictionary["Date"]["Timezone"]["DateTime"]["Texts"]["Month name"][self.user_language], units["Year"])
3133

3234
print(self.large_bar)
3335
print()
@@ -64,7 +66,10 @@ def __init__(self, dictionary = {}):
6466
print(self.large_bar)
6567

6668
def Make_Header(self):
67-
self.dictionary["Today is"] = self.today_is_text_header_prototype.format(self.dictionary["Date"]["Texts"]["Day name"][self.user_language], self.dictionary["Date"]["Units"]["Day"], self.dictionary["Date"]["Texts"]["Month name"][self.user_language], self.dictionary["Date"]["Units"]["Year"])
69+
units = self.dictionary["Date"]["Timezone"]["DateTime"]["Units"]
70+
texts = self.dictionary["Date"]["Timezone"]["DateTime"]["Texts"]
71+
72+
self.dictionary["Today is"] = self.today_is_text_header_prototype.format(texts["Day name"][self.user_language], units["Day"], texts["Month name"][self.user_language], units["Year"])
6873

6974
self.dictionary["Text header"] = self.text_header_prototype.format(self.current_diary_slim["Day"])
7075

@@ -99,16 +104,17 @@ def Match_Time_Pattern(self, select_text):
99104
if time != "" and formatted_text not in select_text:
100105
select_text += formatted_text
101106

102-
#if self.switches["testing"] == False:
103-
if "Check" in self.dictionary:
104-
print()
105-
time = self.Input.Type(select_text, first_space = False)
107+
if self.switches["testing"] == False:
108+
if "Check" in self.dictionary:
109+
print()
106110

107-
if "Check" not in self.dictionary:
108-
print()
111+
time = self.Input.Type(select_text, first_space = False)
109112

110-
#if self.switches["testing"] == True:
111-
time = "00:00"
113+
if "Check" not in self.dictionary:
114+
print()
115+
116+
if self.switches["testing"] == True:
117+
time = "00:00"
112118

113119
i += 1
114120

@@ -128,9 +134,10 @@ def Define_Slim_File(self):
128134
if "Check" not in self.dictionary:
129135
self.Check_Diary_Slims()
130136

131-
print()
132-
print(self.today_is_text)
133-
print()
137+
if "Checked" in self.dictionary:
138+
print()
139+
print(self.today_is_text)
140+
print()
134141

135142
def Check_Diary_Slims(self):
136143
# Define today
@@ -142,7 +149,7 @@ def Check_Diary_Slims(self):
142149
self.dictionary["Yesterday"] = self.Current_Diary_Slim(date = yesterday_date)["Day"]
143150

144151
# Define the Diary Slims list for a more organized code
145-
diary_slims_list = list(self.current_month["Dictionary"]["Diary Slims"].keys())
152+
diary_slims_list = list(self.current_month["Month"]["Diary Slims"].keys())
146153

147154
# If yesterday is not inside the Diary Slims list
148155
# Then the user skipped a Diary Slim
@@ -154,52 +161,56 @@ def Check_Diary_Slims(self):
154161
# Iterate through the days list
155162
for day in days_list:
156163
# Define the date and day text
157-
date = self.Date.Now(self.Date.Date(year = int(self.date["Units"]["Year"]), month = int(self.date["Units"]["Month"]), day = day))
164+
units = self.dictionary["Date"]["Timezone"]["DateTime"]["Units"]
165+
166+
date = self.Date.Now(self.Date.Date(year = int(units["Year"]), month = int(units["Month"]), day = day))
158167

159168
day_text = self.Current_Diary_Slim(date = date)["Day"]
160169

161170
# If the day text is not inside the Diary Slims list
162171
# And the day is less than the current day
163-
if day_text not in diary_slims_list and day < int(self.date["Units"]["Day"]):
172+
if day_text not in diary_slims_list and day < int(units["Day"]):
164173
# Create the day dictionary
165174
diary_slims_dictionary[day_text] = {
166175
"Day text": day_text,
167176
"Date": date
168177
}
169178

170-
# Create the skipped Diary Slims
171-
if diary_slims_dictionary != {}:
172-
# Define the text to show
173-
text = self.language_texts["you_skipped_creating_this_diary_slim"]
179+
# Create the skipped Diary Slims
180+
if diary_slims_dictionary != {}:
181+
# Define the text to show
182+
text = self.language_texts["you_skipped_creating_this_diary_slim"]
174183

175-
if len(list(diary_slims_dictionary.keys())) > 1:
176-
text = self.language_texts["you_skipped_creating_these_diary_slims"]
184+
if len(list(diary_slims_dictionary.keys())) > 1:
185+
text = self.language_texts["you_skipped_creating_these_diary_slims"]
177186

178-
# Show the text
179-
print(text + ":")
187+
# Show the text
188+
print(text + ":")
180189

181-
# Show the names of the skipped Diary Slims
182-
for day in diary_slims_dictionary:
183-
day = diary_slims_dictionary[day]
190+
# Show the names of the skipped Diary Slims
191+
for day in diary_slims_dictionary:
192+
day = diary_slims_dictionary[day]
184193

185-
print(day["Day text"])
194+
print(day["Day text"])
186195

187-
print()
196+
print()
188197

189-
# Create the skipped Diary Slims
190-
for day in diary_slims_dictionary:
191-
day = diary_slims_dictionary[day]
198+
# Create the skipped Diary Slims
199+
for day in diary_slims_dictionary:
200+
day = diary_slims_dictionary[day]
192201

193-
dictionary = {
194-
"Date": day["Date"],
195-
"Check": True
196-
}
202+
dictionary = {
203+
"Date": day["Date"],
204+
"Check": True
205+
}
197206

198-
Create_New_Diary_Slim(dictionary)
207+
Create_New_Diary_Slim(dictionary)
199208

200-
print()
209+
print()
201210

202-
print(self.large_bar)
211+
print(self.large_bar)
212+
213+
self.dictionary["Checked"] = True
203214

204215
def Write_To_Files(self):
205216
from copy import deepcopy
@@ -218,7 +229,7 @@ def Write_To_Files(self):
218229
self.current_day_file_text = self.File.Contents(self.dictionary["File"])["string"]
219230

220231
# Define the text to write
221-
text_to_write = self.dictionary["Text header"] + "\n\n" + self.dictionary["Date"]["Formats"]["HH:MM DD/MM/YYYY"] + ":\n" + self.dictionary["Today is"] + "\n\n" + self.dictionary["Header"]
232+
text_to_write = self.dictionary["Text header"] + "\n\n" + self.dictionary["Date"]["Timezone"]["DateTime"]["Formats"]["HH:MM DD/MM/YYYY"] + ":\n" + self.dictionary["Today is"] + "\n\n" + self.dictionary["Header"]
222233

223234
# If the file is empty
224235
if self.current_day_file_text == "":
@@ -230,10 +241,6 @@ def Write_To_Files(self):
230241
# Write the header text into the Diary Slim file
231242
Write_On_Diary_Slim_Module(text_to_write, add_time = False, check_file_length = False, verbose = verbose)
232243

233-
#if "Check" not in self.dictionary:
234-
# print()
235-
# print(self.dash_space)
236-
237244
# Open the Diary Slim file
238245
self.File.Open(self.dictionary["File"])
239246

@@ -243,34 +250,78 @@ def Write_To_Files(self):
243250
if self.dictionary["Diary Slim exists"] == False:
244251
day = deepcopy(self.templates["Day"])
245252

253+
units = self.dictionary["Date"]["Timezone"]["DateTime"]["Units"]
254+
texts = self.dictionary["Date"]["Timezone"]["DateTime"]["Texts"]
255+
246256
# Create the Day dictionary
247-
day["Day"] = self.dictionary["Date"]["Units"]["Day"]
248-
day["Names"] = self.dictionary["Date"]["Texts"]["Day name"]
249-
day["Formats"]["DD-MM-YYYY"] = self.dictionary["Date"]["Formats"]["DD-MM-YYYY"]
250-
day["Creation time"]["HH:MM"] = self.dictionary["Date"]["Formats"]["HH:MM"]
251-
day["Creation time"]["Hours"] = self.dictionary["Date"]["Units"]["Hour"]
252-
day["Creation time"]["Minutes"] = self.dictionary["Date"]["Units"]["Minute"]
253-
day["Data"]["Sleep times"] = {
254-
"Slept": self.dictionary["Sleeping time"],
255-
"Woke up": self.dictionary["Waking time"]
257+
day = {
258+
"Day": units["Day"],
259+
"Names": texts["Day name"],
260+
"Formats": {
261+
"DD-MM-YYYY": self.dictionary["Date"]["Timezone"]["DateTime"]["Formats"]["DD-MM-YYYY"],
262+
},
263+
"Creation time": {
264+
"HH:MM": self.dictionary["Date"]["Timezone"]["DateTime"]["Formats"]["HH:MM"],
265+
"Hours": units["Hour"],
266+
"Minutes": units["Minute"]
267+
}
256268
}
257269

270+
# Check if the sleep times items are inside the dictionary
271+
keys = [
272+
"Slept",
273+
"Woke up"
274+
]
275+
276+
i = 0
277+
for item in ["Sleeping", "Waking"]:
278+
item = item + " time"
279+
280+
# If the item is inisde the dictionary
281+
if item in self.dictionary:
282+
# Create the data dictionary if it does not exist
283+
if "Data" not in day:
284+
day["Data"] = {
285+
"Sleep times": {}
286+
}
287+
288+
# Add the sleep time to the Day dictionary
289+
day["Data"]["Sleep times"][keys[i]] = self.dictionary[item]
290+
291+
i += 1
292+
258293
# Edit the Month dictionary
259294
key = self.current_diary_slim["Day"]
260295

261-
# Add to the Diary Slims dictionary
262-
self.current_month["Dictionary"]["Diary Slims"][key] = day
296+
# Add to the "Diary Slims" dictionary inside the Month dictionary
297+
self.current_month["Month"]["Diary Slims"][key] = day
298+
299+
# Update the month "Diary Slims" number inside the Month dictionary
300+
self.current_month["Month"]["Numbers"]["Diary Slims"] = len(list(self.current_month["Month"]["Diary Slims"].keys()))
301+
302+
verbose = False
263303

264-
# Update the "Diary Slims" number
265-
self.current_month["Dictionary"]["Numbers"]["Diary Slims"] = len(list(self.current_month["Dictionary"]["Diary Slims"].keys()))
304+
# Edit the "Month.json" file with the new Month dictionary
305+
self.JSON.Edit(self.current_month["File"], self.current_month["Month"], verbose = verbose)
266306

267-
# Edit the "Month.json" file
268-
self.JSON.Edit(self.current_month["File"], self.current_month["Dictionary"], verbose = False)
307+
# ----- #
308+
309+
# Edit the Year dictionary
269310

270311
# Update the Month dictionary inside the Year dictionary
271-
self.current_year["Year"]["Months"][self.current_month["Name"]] = self.current_month["Dictionary"]
312+
self.current_year["Year"]["Months"][self.current_month["Name"]] = self.current_month["Month"]
313+
314+
# Update the "Months" number inside the Year dictionary
315+
self.current_year["Year"]["Numbers"]["Months"] = len(list(self.current_year["Year"]["Months"].keys()))
316+
317+
# Update the Year "Diary Slims" number inside the Year dictionary
318+
self.current_year["Year"]["Numbers"]["Diary Slims"] = 0
319+
320+
# Iterate through the Months list to add to the Year "Diary Slims" number
321+
for month in self.current_year["Year"]["Months"].values():
322+
self.current_year["Year"]["Numbers"]["Diary Slims"] += month["Numbers"]["Diary Slims"]
272323

273-
# Edit the "Year.json" file
274-
self.JSON.Edit(self.folders["diary_slim"]["current_year"]["year"], self.current_year["Year"], verbose = False)
324+
# Edit the "Year.json" file with the new Year dictionary
325+
self.JSON.Edit(self.folders["diary_slim"]["current_year"]["year"], self.current_year["Year"], verbose = verbose)
275326

276327
super().__init__()

Modules/Diary_Slim/Diary_Slim/__init__.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -270,10 +270,10 @@ def Define_Folders_And_Files(self):
270270

271271
self.current_year["Month"]["Folder"] = self.folders["diary_slim"]["current_year"]["root"] + self.current_year["Month"]["Name"] + "/"
272272
self.current_year["Month"]["File"] = self.current_year["Month"]["Folder"] + "Month.json"
273-
self.current_year["Month"]["Dictionary"] = deepcopy(self.templates["Month"])
273+
self.current_year["Month"]["Month"] = deepcopy(self.templates["Month"])
274274

275275
if self.File.Contents(self.current_year["Month"]["File"])["lines"] != []:
276-
self.current_year["Month"]["Dictionary"] = self.JSON.To_Python(self.current_year["Month"]["File"])
276+
self.current_year["Month"]["Month"] = self.JSON.To_Python(self.current_year["Month"]["File"])
277277

278278
self.current_month = self.current_year["Month"]
279279

0 commit comments

Comments
 (0)