Conversation
|
🍅 Не пройден линтинг или базовые тесты |
|
🍅 Пройдено тестов 9 из 16 |
|
🍅 Пройдено тестов 9 из 16 |
|
🍅 Пройдено тестов 9 из 16 |
|
🍅 Пройдено тестов 9 из 16 |
|
🍅 Не пройден линтинг или базовые тесты |
|
🍅 Пройдено тестов 11 из 16 |
|
🍏 Пройдено тестов 16 из 16 |
|
🍅 Не пройден линтинг или базовые тесты |
|
🍏 Пройдено тестов 16 из 16 |
| const isStar = true; | ||
| const isStar = false; | ||
|
|
||
| const minutesPerHour = 60; |
|
|
||
| let dayTimeStrToMinutes = (weekDay, timeStr, timeZone, bankTimeZone) => | ||
| [weekDays.indexOf(weekDay) * minutesPerHour * hourPerDay, | ||
| timeStr.split(':')[0] * minutesPerHour + Number(timeStr.split(':')[1]), |
There was a problem hiding this comment.
timeStr.split(':') можно в переменную, чтобы 2 раза не сплитить
| [weekDays.indexOf(weekDay) * minutesPerHour * hourPerDay, | ||
| timeStr.split(':')[0] * minutesPerHour + Number(timeStr.split(':')[1]), | ||
| (bankTimeZone - (timeZone === undefined ? 0 : Number(timeZone))) * minutesPerHour | ||
| ].reduce((a, b) => a + b); |
There was a problem hiding this comment.
какой тут смысл от reduce, когда можно просто сложить переменные?
| let addTimeToTwoChars = (time) => time.toString().length === 2 ? time.toString() : `0${time}`; | ||
|
|
||
| function minutesToDayTime(minutes, bankTimeZone) { | ||
| let weekDay = parseInt(minutes / (minutesPerHour * hourPerDay)); |
There was a problem hiding this comment.
parseInt(minutes / (minutesPerHour * hourPerDay), 10);
| let bankTimeZone = Number(workingHours.from.split('+')[1]); | ||
| bankTimeZone = isNaN(bankTimeZone) ? 0 : bankTimeZone; | ||
| workingHours = getBankSchedule(workingHours, bankTimeZone); | ||
| let answer = [NaN].concat(Object.keys(schedule) |
There was a problem hiding this comment.
такой код очень сложно читать и понимать
что тут вообще происходит? напиши комментарии, на какой строчке что делается
Например, зачем [NaN] в начале?
Где заканчивается вызов [NaN].concat(... ?
No description provided.