Files
QuizSystem/Quizzer/Quizzer/Pages/Report.cshtml
T
Karsten Jeppesen 9aebb0c68e
CICD-UCN/QuizSystem/pipeline/head This commit looks good
Quizzer: added Report
2026-11-06 08:10:23 +01:00

92 lines
3.9 KiB
Plaintext

@page
@model Quizzer.Pages.ReportModel
@Html.AntiForgeryToken()
@{
ViewData["Title"] = "Quizzer";
Layout = "_Layout-teacher";
}
<div class="container-fluid">
@if (Model.PageStatistics != null)
{ // Select a quiz to show the report for
<div class="row">
<div class="col-xl-12" style="background-color: lightgreen">
<h1><center>Report</center></h1>
</div>
</div>
<div class="row">
<div class="col-xl-12">
<table class="table table-striped table-bordered">
<thead>
<tr>
<th></th>
<th>Class</th>
<th>Quizz</th>
</tr>
</thead>
@foreach (var item in Model.quizzList)
{
<tr>
<td>
<form class="form-horizontal" method="post">
<input type="hidden" name="action" value="selectQuizz" />
<input type="hidden" name="changeTo" value="@item.QuizzId" />
<button type="button" class="btn btn-outline-primary" onclick="javascript:this.form.submit()">Select</button>
</form>
</td>
<td>@item.Class</td>
<td>@item.CategoryText</td>
<td>
<form asp-page="" method="post">
<input type="hidden" name="action" value="delete" />
<input type="hidden" name="changeTo" value="@item.QuizzId" />
<button type="submit" class="btn btn-sm btn-outline-danger"><i class="bi bi-trash"></i></button>
</form>
</td>
</tr>
}
</table>
</div>
</div>
}
else
{ // Show the report for the selected quiz
@if (Model.PageStatistics.Questions.Count > 0 && Model.PageStatistics.MCList.Count > 0)
{
<div class="row">
<h3>Statistics for @Model.SelectedClass (@Model.SelectedCat)</h3><br>
@for (int Qindex = 0; Qindex < Model.PageStatistics.Questions.Count; Qindex++)
{
<table class="table table-sm">
<thead>
<tr>
<th style="width: 10%">Count</th>
<th>@Model.PageStatistics.Questions[Qindex].QuestionText</th>
</tr>
</thead>
@for (int Aindex = 0; Aindex < @Model.PageStatistics.Questions[Qindex].AList.Count; Aindex++)
{
<tr>
<td class="align-text-top">@Model.PageStatistics.MCList[Qindex].Counter[Aindex]</td>
@if (@Model.PageStatistics.Questions[Qindex].AList[Aindex].Aok)
{
<td style="background-color:lightgreen">@Model.PageStatistics.Questions[Qindex].AList[Aindex].Atxt</td>
}
else
{
<td>@Model.PageStatistics.Questions[Qindex].AList[Aindex].Atxt</td>
}
</tr>
}
</table>
}
</div>
}
else
{
<div class="row">
<h3>No statistics available</h3>
</div>
}
}
</div>