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

Pull request #1 from teodoroven #9

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

teodoroven
Copy link

• Added row with total hours in teach plan page
• Added the trimester number parser into the course number + trimester
number in teach plan page
• Fixed consultations button: now it remembers your choice in timetable
page

• Added row with total hours in teach plan page
• Added the trimester number parser into the course number + trimester 
number in teach plan page
• Fixed consultations button: now it remembers your choice in timetable 
page
// Только на странице учебного плана
if (window.location.href.toLowerCase().includes('teach_plan')) {
const tables = document.querySelectorAll('table.common');
Copy link
Collaborator

Choose a reason for hiding this comment

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

В целом всё окей, но нужно кое-что исправить.

  1. Ты вставляешь строку прямо в таблицу, чтобы её отобразить, браузер внутри каждой таблицы создаёт дополнительное tbody для этой строки. Это чревато неожиданными багами, и один из них в том, что у этой строки не отображается border. Нужно вставлять твою строку внутрь tbody. Если в этом селекторе написать table.common > tbody, по идее, всё должно сработать.

Copy link
Author

Choose a reason for hiding this comment

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

Пофиксил

scripts.js Outdated
let content = header.textContent; // Получаем текст заголовка
let number = Number(content.slice(0,content.indexOf(' '))); // Достаём из него номер триместра
header.textContent += ` (${Math.floor(number / 3)+1} курс, ${(number-1) % 3 + 1} триместр)`; // Вычисляем номер курса и добавляем к заголовку
Copy link
Collaborator

Choose a reason for hiding this comment

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

Номер курса в каждом третьем триместре считается неправильно. Например, 3 / 3 + 1 = 1 + 1 = 2 ===> 3 триместр 1 курса становится 3 триместром 2 курса.

Я предлагаю просто использовать Math.ceil вместо Math.floor, ну и соответственно убрать из расчёта курса +1.

https://developer.mozilla.org/ru/docs/Web/JavaScript/Reference/Global_Objects/Math/ceil

Copy link
Author

Choose a reason for hiding this comment

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

Пофиксил

scripts.js Outdated
if (button) {
button.onclick = () => {
localStorage.setItem('showConsultations',String(!checkbox.checked));
Copy link
Collaborator

Choose a reason for hiding this comment

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

Здесь чекбокс прыгает меняет состояние на предыдущее после нажатия. Кажется, надо кидать в локалсторейдж checkbox.checked, а не противоположное ему значение.

Copy link
Author

Choose a reason for hiding this comment

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

Это актуально для onchange, но если использовать onclick, то обработчик срабатывает раньше, чем input меняет состояние checked, поэтому отрицание здесь к месту.

scripts.js Outdated
Comment on lines 688 to 689
const button = document.querySelector('.timetable-btn.consultations');
Copy link
Collaborator

Choose a reason for hiding this comment

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

Ну и последнее: добавь, плз, на всякий случай проверку того, что открыта страница с расписанием. Класс .consultations, наверное, действительно есть только в расписании, но это ж ЕТИС :) Он может внезапно вылезти на какой-то левой странице.

Copy link
Author

Choose a reason for hiding this comment

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

Сделал

• Исправлена неисправность с переводом номера триместра в номер курса
• Общее количество часов отображается только если есть что суммировать
• Исправлена неисправность с отсутствием рамки у строки с общим 
количеством часов в таблице
• Изменена логика consultationsMemorizer
• consultationsMemorizer теперь работает только на странице с 
расписанием
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants