Skip to content

Commit

Permalink
Fixing edgecase
Browse files Browse the repository at this point in the history
  • Loading branch information
LucaBarban committed Dec 21, 2022
1 parent 9454f4e commit f53aa32
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions gcal.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def getFromGoogleCalendar(self) -> list[Lezione]:
while (True):
for event in events["items"]:
try:
tmpAttività = event["description"].split(" ")[0]
tmpAttività = event["description"].split(" in ")[0]
tmpGiorno = event["description"].split(" di ")[1].split(" con ")[0]
tmpClasse = event["description"].split(" in ")[1].split(" di ")[0]
tmpDocnote = event["description"].split(" con ")[1]
Expand All @@ -85,9 +85,10 @@ def getFromGoogleCalendar(self) -> list[Lezione]:
tmpTime = tmpTimeList[0] + ":" + tmpTimeList[1] + "-"
tmpTimeList = event["end"]["dateTime"].split("T")[1].split(":")
tmpTime += tmpTimeList[0] + ":" + tmpTimeList[1]
gCalendar.append(Lezione(event["summary"], tmpGiorno, tmpData, tmpAttività, tmpDocnote, event["location"], tmpClasse, tmpTime, event["id"]))
tmpLocation = "" if "location" not in event else event["location"]
gCalendar.append(Lezione(event["summary"], tmpGiorno, tmpData, tmpAttività, tmpDocnote, tmpLocation, tmpClasse, tmpTime, event["id"]))
except Exception as e:
print("Error reading from google calendar on:", event, e)
print("Error reading from google calendar on:", event, "\nException:", e)
exit()
eventsNumber += len(events["items"])

Expand Down
2 changes: 1 addition & 1 deletion mycaldav.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def getEvents():
tuid = event
event = event.vobject_instance.vevent
tsummary = event.summary.value
tactivity = event.description.value.split(" ")[0]
tactivity = event.description.value.split(" in ")[0]
tday = event.description.value.split(" di ")[1].split("con")[0]
tclass = event.description.value.split(" in ")[1].split(" di ")[0]
tlocation = event.location.value
Expand Down

0 comments on commit f53aa32

Please sign in to comment.