Skip to content
This repository has been archived by the owner on Mar 28, 2024. It is now read-only.

Commit

Permalink
Fixed critical bug when exams take place throughout all day
Browse files Browse the repository at this point in the history
Updated base URL of Google Calendar API and removed outdated link parameters
  • Loading branch information
jtsimoes committed Sep 14, 2023
1 parent 58d5681 commit c566fbc
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 9 deletions.
23 changes: 16 additions & 7 deletions js/examsCalendar.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,25 +49,34 @@ function parseRow(row){
else
epoca = "";
tempDate = row[0].innerText.split("/");
tempHours = row[3].innerText.split(":")
tempHours = row[3].innerText.split(":");

data = new Date();
data.setDate(tempDate[0]);
data.setMonth(tempDate[1]-1);
data.setFullYear(tempDate[2]);
data.setHours(tempHours[0],tempHours[1],0);
//Handle cases where the exam takes place throughout all day
if (tempHours.length == 2)
data.setHours(tempHours[0],tempHours[1],0);
else
data.setHours(0,0,0);

//Create link
link = new URL("https://www.google.com/calendar/render");
link = new URL("https://calendar.google.com/calendar/render");
link.searchParams.append("action", "TEMPLATE");
link.searchParams.append("text", "[" + disciplina + "] Exame " + epoca);

datestart = data.toISOString().replace(/-|:|\.\d\d\d/g,"");
data.setHours(data.getHours() + 2);
dateend = data.toISOString().replace(/-|:|\.\d\d\d/g,"");
if (tempHours.length == 2){
data.setHours(data.getHours() + 2);
dateend = data.toISOString().replace(/-|:|\.\d\d\d/g,"");
} else {
dateend = datestart = datestart.split("T")[0];
}

link.searchParams.append("dates", datestart + "/" + dateend)
link.searchParams.append("details", obs);
link.searchParams.append("location", sala);
link.searchParams.append("sf", "true");
link.searchParams.append("output", "xml");

//Insert link to create event in table
var newNode = document.createElement("td");
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"manifest_version": 2,
"name": "PACO UA Extension",
"version": "0.41",
"version": "0.42",

"description": "Extensão que adiciona funcionalidades extra ao PACO (Portal Académico Online da Universidade de Aveiro)",

Expand Down
2 changes: 1 addition & 1 deletion manifest_v3.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"manifest_version": 3,
"name": "PACO UA Extension",
"version": "0.41",
"version": "0.42",

"description": "Extensão que adiciona funcionalidades extra ao PACO (Portal Académico Online da Universidade de Aveiro)",

Expand Down

0 comments on commit c566fbc

Please sign in to comment.