{% extends 'base' %} {% block title %}Выставление баллов{% endblock %} {% block media %} {{ HTML.script('static/js/functions.js')|raw }} {{ HTML.script('static/js/libs/jquery.fileDownload.js')|raw }} {{ HTML.script('static/js/discipline/rating.js')|raw }} {{ HTML.style('static/css/teacher/discipline/rating.css')|raw }} {% endblock %} {% macro AnchorButton(URL, Text, AnchorTitle, AnchorClass, ButtonClass) %} {{ HTML.anchor(URL, '<button class="' ~ ButtonClass ~ '">' ~ Text ~ '</button>', { 'title': AnchorTitle, 'class': AnchorClass })|raw }} {% endmacro %} {# Вывод данных "прилеплен" для выдачи корректного ответа #} {% macro RateCellCheck(Discipline, ModuleType) %}{{ Discipline.Milestone == 0 and (ModuleType == 'regular' or ModuleType == 'bonus') }}{% endmacro %} {% macro RateCell(Col, Row, Discipline, ModuleType, Rate) %} {% if _self.RateCellCheck(Discipline, ModuleType) %} <td id="col_row_{{ Col }}_{{ Row }}" class="rate {{ ModuleType }}"> <input type="text" value="{{ Rate }}"> </td> {% else %} <td class="rate static {{ ModuleType }}">{{ Rate }}</td> {% endif %} {% endmacro %} {% block main_top_title %}Выставление баллов{% endblock %} {% block main_content %} {% if Discipline.Milestone %} <p class="noEdit">Семестр завершен, выставление баллов запрещено</p> {% endif %} <div class="rateHeader ClearFix"> <h2 class="subject">{{ Discipline.SubjectName }}</h2> {{ _self.AnchorButton('discipline/' ~ Discipline.ID ~ '/exam', 'Сессия', 'Сессия', 'button', 'defaultForm GreenButton') }} {{ _self.AnchorButton('discipline/' ~ Discipline.ID ~ '/history', 'История', 'История', 'button', 'defaultForm GreenButton') }} {{ _self.AnchorButton('discipline/' ~ Discipline.ID ~ '/structure', Discipline.IsLocked ? 'Просмотр' : 'Редактирование', 'История', 'button', 'defaultForm GreenButton') }} <div class="groupSelector"> <span class="defaultForm">Фильтр:</span> <select class="defaultForm" id="groupSelector"> <option value="0">Все группы</option> {% for Group in Groups %} <option value="{{ Group.ID }}"> {% if Group.Degree == 'master' %} Магистратура, {{ Group.GradeNum }} год {% else %} {{ Group.GradeNum }} курс {% endif %} {{ Group.GroupNum }} группа </option> {% endfor %} </select> </div> </div> <div class="rateContent"> <table id="studentsRate"> <thead> {% set ColCount = 3 %} {% for Module in Modules %} {% if Module.Type == 'regular' %} {% set ColCount = ColCount + Module.Submodules|length %} {% else %} {% set ColCount = ColCount + 1 %} {% endif %} {% endfor %} <tr id="modulesHead"> <td>Модуль</td> {% for Module in Modules if Module.Type == 'regular' %} <td colspan="{{ Module.Submodules|length }}">{{ Module.Name }}</td> {% endfor %} <td rowspan="3">Итог за семестр</td> {% if Discipline.IsBonus %} <td rowspan="2">Бонус</td> {% endif %} <td rowspan="3">Добор</td> {% if Discipline.Type == 'exam' %} <td rowspan="3">Экзамен</td> {% endif %} <td rowspan="3">Итог</td> </tr> <tr id="submodulesHead"> {% set Col = 1 %} <td>Мероприятие</td> {% for Module in Modules %} {% for Submodule in Module.Submodules if Module.Type == 'regular'%} <td class="col_{{ Col }}">{{ Submodule.Name }}</td> {% set Col = Col + 1 %} {% endfor %} {% endfor %} {% if Discipline.IsBonus %} <td class="col_{{ Col }}" style="display: none">Бонусные баллы</td> {% set Col = Col + 1 %} {% endif %} </tr> <tr id="submodulesHeadMaxRate"> {% set Col = 1 %} <td>Макс. балл</td> {% for Module in Modules if Module.Type == 'regular' %} {% for Submodule in Module.Submodules %} <td class="col_{{ Col }}" id="regular_{{ Submodule.ID }}">{{ Submodule.Rate }}</td> {% set Col = Col + 1 %} {% endfor %} {% endfor %} {% for Module in Modules if Module.Type == 'bonus' %} {% for Submodule in Module.Submodules %} <td class="col_{{ Col }}" id="bonus_{{ Submodule.ID }}">{{ Submodule.Rate }}</td> {% set Col = Col + 1 %} {% endfor %} {% endfor %} </tr> </thead> <tbody> {% set Row = 1 %} {% for GroupID, StudentsList in Students %} {% set Group = Groups[GroupID] %} <tr id="group_{{ GroupID }}" class="group_{{ GroupID }}"> <td class="group" colspan="{{ ColCount }}"> {% if Group.Degree == 'master' %} Магистратура, {{ Group.GradeNum }} год {% else %} {{ Group.GradeNum }} курс {% endif %} {{ Group.GroupNum }} группа </td> </tr> {% for Student in StudentsList %} <tr id="row_{{ Row }}" class="group_{{ GroupID }}"> {% set Col = 1 %} {% set SemesterRate = 0 %} {% set BonusRate = 0 %} {% set ExtraRate = 0 %} {% set ExamRate = 0 %} <td id="student_{{ Student.ID }}" class="name"> {{ Student.LastName }} {{ Student.FirstName }} </td> {% for Module in Modules if Module.Type == 'regular'%} {% for Submodule in Module.Submodules %} {% set Rate = Rates[Student.ID][Submodule.ID] %} {{ _self.RateCell(Col, Row, Discipline, 'regular', Rate) }} {% set Col = Col + _self.RateCellCheck(Discipline, 'regular') %} {% set SemesterRate = SemesterRate + Rate %} {% endfor %} {% endfor %} {{ _self.RateCell(Col, Row, Discipline, 'semester', SemesterRate) }} {% set Col = Col + _self.RateCellCheck(Discipline, 'semester') %} {% if Discipline.IsBonus %} {% for Module in Modules if Module.Type == 'bonus' %} {% for Submodule in Module.Submodules %} {% set Rate = Rates[Student.ID][Submodule.ID] %} {% set BonusRate = Rate %} {% endfor %} {% endfor %} {{ _self.RateCell(Col, Row, Discipline, 'bonus', BonusRate ? BonusRate) }} {% set Col = Col + _self.RateCellCheck(Discipline, 'bonus') %} {% endif %} {% for Module in Modules if Module.Type == 'extra' %} {% for Submodule in Module.Submodules %} {% set Rate = Rates[Student.ID][Submodule.ID] %} {% set ExtraRate = ExtraRate + Rate %} {% endfor %} {% endfor %} {{ _self.RateCell(Col, Row, Discipline, 'extra', ExtraRate ? ExtraRate) }} {% set Col = Col + _self.RateCellCheck(Discipline, 'extra') %} {% if Discipline.Type == 'exam' %} {% for Module in Modules if Module.Type == 'exam' %} {% for Submodule in Module.Submodules %} {% set Exam = Exams[Student.ID][Submodule.ID] %} {% set Rate = (Exam.Absence or Exam.AutoPass) ? "" : Exam.Rate %} {% set ExamRate = max(ExamRate, Rate) %} {% endfor %} {% endfor %} {{ _self.RateCell(Col, Row, Discipline, 'exam', ExamRate ? ExamRate) }} {% set Col = Col + _self.RateCellCheck(Discipline, 'exam') %} {% endif %} {% set ResultRate = SemesterRate + BonusRate + ExtraRate + ExamRate %} {{ _self.RateCell(Col, Row, Discipline, 'result', ResultRate > 100 ? '100+' : ResultRate) }} {% set Col = Col + _self.RateCellCheck(Discipline, 'result') %} </tr> {% set Row = Row + 1 %} {% endfor %} {% endfor %} </tbody> </table> </div> <div id="cellInfo" class="cellInfo"> <span id="student" class="field"> <span class="name">Студент:</span> <span class="value"></span> </span> <span id="submodule" class="field"> <span class="name">Мероприятие:</span> <span class="value"></span> </span> <span id="maxRate" class="field"> <span class="name">Максимальный балл:</span> <span class="value"></span> </span> </div> <div id="json_discipline" style="display: none"> {{ Discipline|json_encode|raw }} </div> {% endblock %}