redcrafter502 / untis-to-calendar

A simple tool to sync your untis timetable to your calender application using ics.
https://untis-to-calendar.vercel.app
Apache License 2.0
0 stars 0 forks source link

Display teacher in calender #15

Open redcrafter502 opened 2 months ago

redcrafter502 commented 2 months ago

Look using a console.log where the teacher is stored in the object gotten from Untis. And then find a way to display it in the event.

Rodney1988 commented 2 months ago

Hi @redcrafter502, I would like to help you out on this, but not sure what you mean by the description. Also, do I need some more info/auth data?

redcrafter502 commented 2 months ago

@Rodney1988 Thank you for wanting to help me with this project. For my school it is the case that you can see the teacher names only on the website and not on the app or with the api when logged out. But when logged in you can see the teacher on the website and on the app. And when I wrote this issue I assumed that it would be possible using the api as well but it is not. Teachers are not included when calling untis.getOwnTimetableFor(date) and calling untis.getTeachers() does not return anything. The only way to get teachers is calling untis.getHomeWorksFor(startDate, endDate). But this only returns the teachers for the homework and them not connected with their homework, so this can't be used for inserting into the calendar. But I don't know how your school has configured Untis, so maybe it is possible for you to see the teachers using the api. To test that you should include an console.log(timetable[0]) before the line const events = timetable.map(lesson => { to return the first lesson in your timetable. You could also try including console.log(await untis.getTeachers(). Regarding your question about authentication. When using the app you can choose between using a public timetable (only works if your Untis timetable is publicly accessable) and a private timetable (you need to insert your untis username and password (I don't know if it works with two factor authentication)). You can get your school id by opening your webuntis timetable in your browser and looking at the school parameter in the url. You need an account to use untis-to-calendar. If you are running your instance locally and if you have your postgres database correctly setup, you need to create an account in the database for now. Do this by inserting a row in the users table. The password needs to be hashed with bcrypt. $2a$12$4NleLs1trG5OwWO4Rq6kUe5HRvvbWpoC.z6dc0z7dze9KBOX/pawi is a bcrypt hash for the password password. I hope this answer helped you.