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

fixes powerschool showing icons next to every assignment #276

Merged
merged 3 commits into from
Apr 28, 2021
Merged
Changes from 1 commit
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
5 changes: 3 additions & 2 deletions src/js/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ function extractAssignmentList () {
const assignments = [];
[...table.querySelectorAll('tr')].slice(1, -1).forEach((e, i) => {
const curr = e.querySelectorAll('td');
assignments.push(new ClassAssignment(i, curr[0].innerHTML, curr[1].innerHTML, curr[2].innerHTML, curr[3].hasChildNodes(), curr[4].hasChildNodes(), curr[5].hasChildNodes(), curr[6].hasChildNodes(), curr[7].hasChildNodes(), curr[8].innerHTML, curr[10].innerHTML));
assignments.push(new ClassAssignment(i, curr[0].innerHTML, curr[1].innerHTML, curr[2].innerHTML, curr[3].hasChildNodes() && curr[3].childNodes[0].style.display !== 'none', curr[4].hasChildNodes() && curr[4].childNodes[0].style.display !== 'none', curr[5].hasChildNodes() && curr[5].childNodes[0].style.display !== 'none', curr[6].hasChildNodes() && curr[6].childNodes[0].style.display !== 'none', curr[7].hasChildNodes() && curr[7].childNodes[0].style.display !== 'none', curr[8].innerHTML, curr[10].innerHTML));
Suhas-13 marked this conversation as resolved.
Show resolved Hide resolved
});
return assignments;
}
Expand All @@ -203,7 +203,8 @@ function assignments (node) {
[...node.querySelector('table[align=center').querySelectorAll('tr')].slice(1, -1).forEach((e, i) => {
const curr = e.querySelectorAll('td');
const assignment = new Assignment(curr[2]?.innerText || "", curr[curr.length - 1]?.innerText || "", i);
if (e.querySelector('img[src="/images/icon_missing.gif"]')) {
const missingIcon = e.querySelector('img[src="/images/icon_missing.gif"]');
if (missingIcon && missingIcon.style.display !== 'none') {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can simply this to the following, actually:

Suggested change
if (missingIcon && missingIcon.style.display !== 'none') {
if (missingIcon?.style.display !== 'none') {

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this actually works here as for some classes this will be null due to inconsistent CSS(some classes don't contain the missingicon gif and some do), and as such it should be counted as not missing if it doesn't exist.

assignment.addStatus(Assignment.statuses.MISSING);
}
tr.push(assignment);
Expand Down