#21 -- Fix displaying statistic
This commit is contained in:
parent
36d6f44378
commit
732ffc3441
@ -5,10 +5,15 @@ import org.springframework.ui.Model;
|
|||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import ru.ulstu.aspirant.model.Aspirant;
|
||||||
|
import ru.ulstu.indicator.model.Course;
|
||||||
import ru.ulstu.report.service.ReportPeriodService;
|
import ru.ulstu.report.service.ReportPeriodService;
|
||||||
|
import ru.ulstu.statistic.model.RatingItem;
|
||||||
import ru.ulstu.statistic.model.StatisticForm;
|
import ru.ulstu.statistic.model.StatisticForm;
|
||||||
import ru.ulstu.statistic.service.StatisticService;
|
import ru.ulstu.statistic.service.StatisticService;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping("statistic")
|
@RequestMapping("statistic")
|
||||||
public class StatisticController {
|
public class StatisticController {
|
||||||
@ -25,12 +30,16 @@ public class StatisticController {
|
|||||||
public String getStatistic(Model model) {
|
public String getStatistic(Model model) {
|
||||||
model.addAttribute("statisticForm", new StatisticForm());
|
model.addAttribute("statisticForm", new StatisticForm());
|
||||||
model.addAttribute("reportPeriods", reportPeriodService.getReportPeriods());
|
model.addAttribute("reportPeriods", reportPeriodService.getReportPeriods());
|
||||||
|
model.addAttribute("rating", List.of(new RatingItem(new Aspirant("Иванов", Course.FIRST), 20)));
|
||||||
return "/statistic/statistic";
|
return "/statistic/statistic";
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("statistic")
|
@PostMapping("statistic")
|
||||||
public String getStatistic(StatisticForm form, Model model) {
|
public String getStatistic(StatisticForm form, Model model) {
|
||||||
model.addAttribute("rating", statisticService.getRating(form.getReportPeriod().getId()));
|
//model.addAttribute("rating", statisticService.getRating(form.getReportPeriod().getId()));
|
||||||
|
model.addAttribute("statisticForm", form);
|
||||||
|
model.addAttribute("reportPeriods", reportPeriodService.getReportPeriods());
|
||||||
|
model.addAttribute("rating", List.of(new RatingItem(new Aspirant("Иванов", Course.FIRST), 20)));
|
||||||
return "/statistic/statistic";
|
return "/statistic/statistic";
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -5,9 +5,13 @@
|
|||||||
|
|
||||||
<form action="/statistic/statistic" method="post" th:object="${statisticForm}">
|
<form action="/statistic/statistic" method="post" th:object="${statisticForm}">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col col-md-6">
|
<div class="col col-md-2">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="period">Период отчетности</label>
|
<label for="period">Период отчетности</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col col-md-4">
|
||||||
|
<div class="form-group">
|
||||||
<select class="form-select form-control"
|
<select class="form-select form-control"
|
||||||
id="period" aria-label="multiple select example"
|
id="period" aria-label="multiple select example"
|
||||||
th:field="*{reportPeriod}">
|
th:field="*{reportPeriod}">
|
||||||
@ -18,6 +22,11 @@
|
|||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="col col-md-4">
|
||||||
|
<div class="form-group">
|
||||||
|
<button type="submit" class="btn btn-outline-dark">Применить</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
@ -30,6 +39,10 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
<tr th:each="r : ${rating}">
|
||||||
|
<td th:text="${r.aspirant.surname + ' '+ r.aspirant.name + ' '+ r.aspirant.patronymic }"></td>
|
||||||
|
<td th:text="${r.score}"></td>
|
||||||
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user