-
Notifications
You must be signed in to change notification settings - Fork 3
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
base: master
Are you sure you want to change the base?
Conversation
• 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'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
В целом всё окей, но нужно кое-что исправить.
- Ты вставляешь строку прямо в таблицу, чтобы её отобразить, браузер внутри каждой таблицы создаёт дополнительное tbody для этой строки. Это чревато неожиданными багами, и один из них в том, что у этой строки не отображается border. Нужно вставлять твою строку внутрь tbody. Если в этом селекторе написать table.common > tbody, по идее, всё должно сработать.
There was a problem hiding this comment.
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} триместр)`; // Вычисляем номер курса и добавляем к заголовку |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Здесь чекбокс прыгает меняет состояние на предыдущее после нажатия. Кажется, надо кидать в локалсторейдж checkbox.checked, а не противоположное ему значение.
There was a problem hiding this comment.
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
const button = document.querySelector('.timetable-btn.consultations'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ну и последнее: добавь, плз, на всякий случай проверку того, что открыта страница с расписанием. Класс .consultations, наверное, действительно есть только в расписании, но это ж ЕТИС :) Он может внезапно вылезти на какой-то левой странице.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Сделал
• Исправлена неисправность с переводом номера триместра в номер курса • Общее количество часов отображается только если есть что суммировать • Исправлена неисправность с отсутствием рамки у строки с общим количеством часов в таблице • Изменена логика consultationsMemorizer
• 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