-
Notifications
You must be signed in to change notification settings - Fork 139
#1749 progress data added to profile page #1761
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
base: develop
Are you sure you want to change the base?
Conversation
0af4336 to
3fe0022
Compare
|
@Michael57e развернул на https://hexlet-sicp-aakz.onrender.com/, можно посмотреть |
|
@ddm14159 посмотрел. списки разворачиваются и сворачиваются, интуитивно понятно. пройденные уроки и главы сохраняются корректно. цветовые интикаторы работают корректно. ссылки на упражнения ведут куда нужно |
|
@ddm14159 если можно смотреть, то сделай пожалуйста ребейз, чтобы убрать лишние изменения. |
c87492f to
b1649dd
Compare
|
@fey сделал ребейс |
| use App\Helpers\ChapterHelper; | ||
|
|
||
| $hasChildren = $chapter->children->isNotEmpty(); | ||
| $isCompleted = $chapterMembers->has($chapter->id) && $chapterMembers[$chapter->id]->isFinished(); |
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.
это и выше - эта логика не относится ко представлению, ведь это "бизнес" логика".
Если тебе нужны данные чисто для вью, то можно создать класс-dto для обертки данных.
| default => '' | ||
| }; | ||
|
|
||
| $badgeSize = $level > 0 ? 'small' : ''; |
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.
| $completedChildren = 0; | ||
| $totalChildren = 0; | ||
|
|
||
| foreach($chapter->children as $child) { |
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.
здесь это что-то на страшном. Эта логика точно здесь должна быть? Как будто бы нет, и ее можно как минимум в метод контроллера перенести.
Плюс в цикле вызывается $fullChild = $chapters->find($child->id); - на каждую итерацию цикла будет вызов.
Что вообще делает вся это логика? Если это расчет прогресса, то можно создать для этого класс, который будет так называться (прогресс калькулятор и тд)
Добавил разворачивающиеся списки с информацией о прогрессе

