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

Add ability to identify student's course level #9

Open
marvinIsSacul opened this issue Jun 13, 2023 · 15 comments
Open

Add ability to identify student's course level #9

marvinIsSacul opened this issue Jun 13, 2023 · 15 comments
Assignees
Labels
enhancement New feature or request

Comments

@marvinIsSacul
Copy link
Owner

Having this will help in creating optimized timetables for all course levels

@marvinIsSacul marvinIsSacul added the enhancement New feature or request label Jun 13, 2023
@marvinIsSacul marvinIsSacul self-assigned this Jun 13, 2023
@zalimitless
Copy link
Collaborator

There are 2 ways to do this:
The first method is to just scrape the information from the php call: https://mylms.vossie.net/mytimetable/index.php
The other method, if you just want the courses, is you can do an API call to get the courses:
"https://mylms.vossie.net/lib/ajax/service.php?sesskey=" + sesskey + "&info=theme_remui_get_myoverviewcourses"
You can scrape the sesskey from the website using something like:

var input = document.querySelector('#usernavigation form input[name="sesskey"]');
if (input) {
    resolve(input.value);
}

@zalimitless
Copy link
Collaborator

zalimitless commented Jun 13, 2023

I spoke with IT regarding the course times and how it is managed.
They said that they are using a software called Untis that manages the timesheets.
It would be nice if we can figure out a way to directly integrate with that system if possible.

https://help.untis.at/hc/de/articles/4886785534354-API-documentation-for-integration-partners

@marvinIsSacul marvinIsSacul removed their assignment Jun 13, 2023
@marvinIsSacul
Copy link
Owner Author

I see.

I've assigned you to the task then.

There are 2 ways to do this: The first method is to just scrape the information from the php call: https://mylms.vossie.net/mytimetable/index.php The other method, if you just want the courses, is you can do an API call to get the courses: "https://mylms.vossie.net/lib/ajax/service.php?sesskey=" + sesskey + "&info=theme_remui_get_myoverviewcourses" You can scrape the sesskey from the website using something like:

var input = document.querySelector('#usernavigation form input[name="sesskey"]');
if (input) {
    resolve(input.value);
}

@marvinIsSacul
Copy link
Owner Author

I spoke with IT regarding the course times and how it is managed. They said that they are using a software called Untis that manages the timesheets. It would be nice if we can figure out a way to directly integrate with that system if possible.

https://help.untis.at/hc/de/articles/4886785534354-API-documentation-for-integration-partners

Nice man. this is great.

I'll also do some research from my side to try and figure it out.

@zalimitless
Copy link
Collaborator

zalimitless commented Jun 13, 2023

Unfortunately this second method does not contain any course times.
image

There are 2 ways to do this: The first method is to just scrape the information from the php call: https://mylms.vossie.net/mytimetable/index.php The other method, if you just want the courses, is you can do an API call to get the courses: "https://mylms.vossie.net/lib/ajax/service.php?sesskey=" + sesskey + "&info=theme_remui_get_myoverviewcourses" You can scrape the sesskey from the website using something like:

var input = document.querySelector('#usernavigation form input[name="sesskey"]');
if (input) {
    resolve(input.value);
}

@marvinIsSacul
Copy link
Owner Author

Unfortunately this second method does not contain any course times. image

There are 2 ways to do this: The first method is to just scrape the information from the php call: https://mylms.vossie.net/mytimetable/index.php The other method, if you just want the courses, is you can do an API call to get the courses: "https://mylms.vossie.net/lib/ajax/service.php?sesskey=" + sesskey + "&info=theme_remui_get_myoverviewcourses" You can scrape the sesskey from the website using something like:

var input = document.querySelector('#usernavigation form input[name="sesskey"]');
if (input) {
    resolve(input.value);
}

Ahh I see.

Perhaps we might need to use a combination of the 2 then 🤔

@marvinIsSacul
Copy link
Owner Author

Unfortunately this second method does not contain any course times. image

There are 2 ways to do this: The first method is to just scrape the information from the php call: https://mylms.vossie.net/mytimetable/index.php The other method, if you just want the courses, is you can do an API call to get the courses: "https://mylms.vossie.net/lib/ajax/service.php?sesskey=" + sesskey + "&info=theme_remui_get_myoverviewcourses" You can scrape the sesskey from the website using something like:

var input = document.querySelector('#usernavigation form input[name="sesskey"]');
if (input) {
    resolve(input.value);
}

This is very useful though. I wasn't aware of this API call before

@zalimitless
Copy link
Collaborator

The call also requires a default payload:

            var payload = JSON.stringify([{
                "index": 0,
                "methodname": "theme_remui_get_myoverviewcourses",
                "args": {
                    "offset": 0,
                    "limit": 24,
                    "classification": "all",
                    "sort": "fullname",
                    "customfieldname": "",
                    "customfieldvalue": ""
                }
            }]);

            return fetch(url, {
                    method: 'POST',
                    headers: {
                        'Content-Type': 'application/json'
                    },
                    body: payload
                })
                .then(function(response) {
                    if (!response.ok) {
                        throw new Error("HTTP error " + response.status);
                    }
                    return response.json();
                })
                .then(function(data) {
                       //... work with data
                })
                .catch(function(err) {
                    console.error("Error: ", err);
                });
        }

@zalimitless
Copy link
Collaborator

IT also mentioned that the courses are categorized in "Folders" on Moodle:
image
image

Might need to explore the Moodle API to see if getting this could be possible.

@zalimitless
Copy link
Collaborator

Something that would be nice to have is to scrape the Teams link as well:
image

The issue with scraping the link at the moment is that when doing a request to this PHP page is that the HTML can change at any given time and is a lot of HTML to scrape through. The page can also change at any given time as the DFL Department is frequently changing this HTML page.

@zalimitless
Copy link
Collaborator

zalimitless commented Jun 13, 2023

Request URL:
https://mylms.vossie.net/lib/ajax/service.php?sesskey=FDOZGW5Msj&info=core_courseformat_get_state

Request Method:
POST

Request Payload:
[{"index":0,"methodname":"core_courseformat_get_state","args":{"courseid":3505}}]

Sample:
image

This will return all the general resources available for the specific course that we are trying to access - Course ID 3505 is referring to ITPLA1-22

If we do a search for the keyword "Join" we can then get another PHP page, which could reduce the HTML to scrape.
image

@marvinIsSacul
Copy link
Owner Author

IT also mentioned that the courses are categorized in "Folders" on Moodle: image image

Might need to explore the Moodle API to see if getting this could be possible.

nice. but what about timetables... isn't there an API call that one can use to get them as well instead of trying to scrape the timetable PHP page ?

@zalimitless
Copy link
Collaborator

nice. but what about timetables... isn't there an API call that one can use to get them as well instead of trying to scrape the timetable PHP page ?

I will have a check on that, could also maybe ask IT on how it's done in the backend

@marvinIsSacul
Copy link
Owner Author

Yea. that would be nice

@marvinIsSacul
Copy link
Owner Author

Might need to explore the Moodle API to see if getting this could be possible

Might be tricky getting access to this since it's on the backend 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants