Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Behaviour fixes #131

Merged
merged 3 commits into from
Oct 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions api.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,11 +179,10 @@ export const getAllNextCourses = async (icals) => {
for(let c of icals[promo].classes) {
let promises = []
promises.push(getNextCourse(c.classIcal));
if(! typeof c.groups === undefined) {
try {
promises.push(getNextCourse(c.groups.prime));
promises.push(getNextCourse(c.groups.seconde));
}

promises.push(getNextCourse(c.groups.seconde))
} catch(e) {};
await Promise.all(promises).then(data => {
classes.push({
promotion: promo,
Expand Down
22 changes: 11 additions & 11 deletions app.vue
Original file line number Diff line number Diff line change
Expand Up @@ -109,23 +109,23 @@ export default {
The order in the object is the display order
*/
lundi: {
time: () => DEVELOPEMENT_MODE ? 10000 : 1000 * 15,
time: () => DEVELOPEMENT_MODE ? 10000 : 1000 * 7,
allowed: () => true && !this.isEndOfDay() && new Date().getDay() === 1,
},
mardi: {
time: () => DEVELOPEMENT_MODE ? 10000 : 1000 * 15,
time: () => DEVELOPEMENT_MODE ? 10000 : 1000 * 7,
allowed: () => true && !this.isEndOfDay() && new Date().getDay() === 2,
},
mercredi: {
time: () => DEVELOPEMENT_MODE ? 10000 : 1000 * 15,
time: () => DEVELOPEMENT_MODE ? 10000 : 1000 * 7,
allowed: () => true && !this.isEndOfDay() && new Date().getDay() === 3,
},
jeudi: {
time: () => DEVELOPEMENT_MODE ? 10000 : 1000 * 15,
time: () => DEVELOPEMENT_MODE ? 10000 : 1000 * 7,
allowed: () => true && !this.isEndOfDay() && new Date().getDay() === 4,
},
vendredi: {
time: () => DEVELOPEMENT_MODE ? 10000 : 1000 * 15,
time: () => DEVELOPEMENT_MODE ? 10000 : 1000 * 7,
allowed: () => true && !this.isEndOfDay() && new Date().getDay() === 5,
},
planning: {
Expand Down Expand Up @@ -155,28 +155,28 @@ export default {
},
/* Enable this at the start of each year (The QR code has to be updated)*/
discord: {
time: () => DEVELOPEMENT_MODE ? 10000 : 1000 * 30,
time: () => DEVELOPEMENT_MODE ? 10000 : 1000 * 7,
allowed: () => true,
},
/* Enable when looking for new maintainers */
maintainer: {
time: () => DEVELOPEMENT_MODE ? 10000 : 1000 * 15,
time: () => DEVELOPEMENT_MODE ? 10000 : 1000 * 10,
allowed: () => true && !this.isEndOfDay(),
},
announcement: {
time: () => DEVELOPEMENT_MODE ? 10000 : 1000 * 15,
time: () => DEVELOPEMENT_MODE ? 10000 : 1000 * 7,
allowed: () => true && !this.isEndOfDay(),
},
announcement2: {
time: () => DEVELOPEMENT_MODE ? 10000 : 1000 * 15,
time: () => DEVELOPEMENT_MODE ? 10000 : 1000 * 7,
allowed: () => true && !this.isEndOfDay(),
},
tannouncement: {
time: () => DEVELOPEMENT_MODE ? 10000 : 1000 * 15,
time: () => DEVELOPEMENT_MODE ? 10000 : 1000 * 7,
allowed: () => false && !this.isEndOfDay(),
},
welcAmericans: {
time: () => DEVELOPEMENT_MODE ? 10000 : 1000 * 15,
time: () => DEVELOPEMENT_MODE ? 10000 : 1000 * 7,
allowed: () => false && !this.isEndOfDay(),
}
},
Expand Down
18 changes: 12 additions & 6 deletions views/NextPlannings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ function setCurrentHourRange() {
}
}

async function refresh() {
async function getCourses() {
let tmp = await api.getAllNextCourses(icals);
return tmp;
};

async function getAllPlannings(cls) {
async function processPlannings(cls) {
console.log("Refreshing plannings");
edt.info_but1 = [];
edt.info_but2 = [];
Expand All @@ -53,7 +53,7 @@ async function getAllPlannings(cls) {
let secondeEvent = c.groups.seconde;
const classEvent = c.nextCourse;
//Switching between columns depending on the promotion
if(classEvent !== undefined && classEvent !== {}) {
if(classEvent !== undefined && JSON.stringify(classEvent) !== JSON.stringify({"Salle":""})) {
primeEvent = classEvent;
secondeEvent = classEvent;
}
Expand All @@ -62,7 +62,7 @@ async function getAllPlannings(cls) {
case "info_but1":
edt.info_but1.push({
className: c.className,
isFullClass: classEvent !== undefined && classEvent !== {},
isFullClass: classEvent !== undefined && JSON.stringify(classEvent) !== JSON.stringify({"Salle":""}),
type: [
primeEvent ? primeEvent.Type : undefined,
secondeEvent ? secondeEvent.Type : undefined,
Expand Down Expand Up @@ -162,10 +162,16 @@ async function getAllPlannings(cls) {
}
}

let refresh = async () => {
setCurrentHourRange();
let classes = await getCourses();
await processPlannings(classes);
}

onMounted(async () => {
setCurrentHourRange();
let classes = await refresh()
await getAllPlannings(classes)
let classes = await getCourses()
await processPlannings(classes)
refreshInterval = setInterval(refresh(), delay);
})

Expand Down