Skip to content

Examples

Alex Fantini edited this page Sep 21, 2023 · 1 revision

UniBoLessons is the identifier of the library

If your degree programme has different curricula, please see Available method > getDegreeProgramme

Insert a single course

function checkLessons(){
	const calendar = CalendarApp.getCalendarsByName('University Lessons')[0];
	const mail = "[email protected]";

	const dp = UniBoLessons.getDegreeProgramme("https://corsi.unibo.it/laurea/IngegneriaInformatica/orario-lezioni");
	const course = dp.getCourse("Analisi matematica T-1", 1);
	course.createLessons(calendar, mail);
}

Select a module of a single course

function checkLessons(){
	const calendar = CalendarApp.getCalendarsByName('University Lessons')[0];
	const mail = "[email protected]";

	const dp = UniBoLessons.getDegreeProgramme("https://corsi.unibo.it/laurea/IngegneriaInformatica/orario-lezioni");
	const course = dp.getCourse("Fondamenti di informatica T-1", 1, ["Modulo 2"]);
	course.createLessons(calendar, mail);
}

Skip some lessons of a single course

Ex. skips all classes reserved for L-Zs and all classes after Dec. 20

function checkLessons(){
	const calendar = CalendarApp.getCalendarsByName('University Lessons')[0];
	const mail = "[email protected]";

	const dp = UniBoLessons.getDegreeProgramme("https://corsi.unibo.it/laurea/IngegneriaInformatica/orario-lezioni");
	const course = dp.getCourse("Fondamenti di informatica T-1", 1, ["Modulo 2"]);

	course.setSkipLessons(skipLessons);
	course.createLessons(calendar, mail);
}

function skipLessons(event){
	return event.title.includes("L-Z") || new Date(event.start).valueOf() >= new Date(2023, 11, 20);
}

Insert all lessons of a year

function checkLessons(){
	const calendar = CalendarApp.getCalendarsByName('University Lessons')[0];
	const mail = "[email protected]";

	const dp = UniBoLessons.getDegreeProgramme("https://corsi.unibo.it/laurea/IngegneriaInformatica/orario-lezioni");
	dp.createAllLessonsOfYear(1, calendar, mail);
}

Skip some lessons of a year

Ex. skips all classes reserved for L-Zs and all classes after Dec. 20

function checkLessons(){
	const calendar = CalendarApp.getCalendarsByName('University Lessons')[0];
	const mail = "[email protected]";

	const dp = UniBoLessons.getDegreeProgramme("https://corsi.unibo.it/laurea/IngegneriaInformatica/orario-lezioni");
	dp.setSkipLessons(skipLessons);
	dp.createAllLessonsOfYear(1, calendar, mail);
}

function skipLessons(event){
	return event.title.includes("L-Z") || new Date(event.start).valueOf() >= new Date(2023, 11, 20);
}