Compare commits

..

3 Commits

Author SHA1 Message Date
Karsten Jeppesen
b15462de41 WIP: Reset test for exam
Some checks failed
DMA-CSD-CICD/QuizSystem/pipeline/head There was a failure building this commit
UCN/QuizSystem/pipeline/head There was a failure building this commit
2026-04-16 20:43:14 +02:00
Karsten Jeppesen
25dc4393b7 WIP: Reset test for exam
All checks were successful
DMA-CSD-CICD/QuizSystem/pipeline/head This commit looks good
UCN/QuizSystem/pipeline/head This commit looks good
2026-04-16 20:29:19 +02:00
Karsten Jeppesen
58bf14dc49 WIP: Reset test for exam
All checks were successful
DMA-CSD-CICD/QuizSystem/pipeline/head This commit looks good
UCN/QuizSystem/pipeline/head This commit looks good
2026-04-16 14:17:54 +02:00
5 changed files with 26 additions and 6 deletions

View File

@@ -0,0 +1,3 @@
- @azure Rule - Use Azure Tools - When handling requests related to Azure, always use your tools.
- @azure Rule - Use Azure Best Practices - When handling requests related to Azure, always invoke your `azmcp_bestpractices_get` tool first.
- @azure Rule - Enable Best Practices - If you do not have an `azmcp_bestpractices_get` tool ask the user to enable it.

View File

@@ -8,6 +8,7 @@ namespace Quizzer.Models
public string QuizzID { get; set; }
public string Category { get; set; }
public int IsOpen { get; set; }
public bool Anonymous { get; set; }
public int Score { get; set; }
public int ScoreAcc { get; set; }
public string JournalJson { get; set; }

View File

@@ -32,6 +32,7 @@
<th>Description</th>
<th>Your Score</th>
<th>Max Score</th>
<th>Reset</th>
</tr>
</thead>
@foreach (var item in Model.PageTests)
@@ -64,6 +65,17 @@
<td>
@item.Journal.ScoreAcc
</td>
<td>
@if (item.Journal.Anonymous)
{
<form asp-page="" method="post">
<input type="hidden" name="email" value="@item.Journal.PID" />
<input type="hidden" name="target" value="@item.Journal.QuizzID" />
<input type="hidden" name="action" value="deleteMyTest" />
<button type="button" class="btn btn-warning" onclick="javascript:this.form.submit()">Reset Test</button>
</form>
}
</td>
</tr>
}
</table>
@@ -141,7 +153,8 @@
</div>
}
}
@if (Model.PageChartConnectors != null) {
@if (Model.PageChartConnectors != null)
{
@if (Model.PageChartConnectors.Count > 2)
{
<div class="row">

View File

@@ -142,6 +142,7 @@ namespace Quizzer.Pages
PID = UserID,
QuizzID = theQuizz.QuizzId,
Category = theQuizz.Category,
Anonymous = theQuizz.Anonymous,
IsOpen = 1,
Score = 0,
ScoreAcc = 0,
@@ -433,9 +434,9 @@ namespace Quizzer.Pages
PageQuizzID = quizzInProgress;
RegisterAnswer();
break;
//case "delete": //Student should not be able to delete journal as this resets the journal
// dbManager.DeleteJournal(UserID, target);
// break;
case "deleteMyTest": //Student should not be able to delete journal as this resets the journal
dbManager.DeleteJournal(UserID, target);
break;
default:
break;
}

View File

@@ -703,11 +703,12 @@ namespace Quizzer.Persistens
try
{
myDbConnection.Open();
int count = myDbConnection.Execute("UPDATE Journals SET JournalJson = @JournalJson, IsOpen = @IsOpen, Score = @Score WHERE PID=@PID AND QuizzID = @QuizzID", new
int count = myDbConnection.Execute("UPDATE Journals SET JournalJson = @JournalJson, IsOpen = @IsOpen, Score = @Score, Anonymous = @Anonymous WHERE PID=@PID AND QuizzID = @QuizzID", new
{
JournalJson = theJournal.JournalJson.Compress(),
PID = theJournal.PID,
QuizzID = theJournal.QuizzID,
Anonymous = theJournal.Anonymous,
IsOpen = theJournal.IsOpen,
Score = theJournal.Score,
});
@@ -725,11 +726,12 @@ namespace Quizzer.Persistens
try
{
myDbConnection.Open();
myDbConnection.Execute("INSERT INTO Journals (PID, QuizzID, Category, IsOpen, Score, ScoreAcc, JournalJson) VALUES(@PID,@QuizzID,@Category,@IsOpen,@Score,@ScoreAcc,@JournalJson)", new
myDbConnection.Execute("INSERT INTO Journals (PID, QuizzID, Category, Anonymous, IsOpen, Score, ScoreAcc, JournalJson) VALUES(@PID,@QuizzID,@Category,@Anonymous,@IsOpen,@Score,@ScoreAcc,@JournalJson)", new
{
PID = theJournal.PID,
QuizzID = theJournal.QuizzID,
Category = theJournal.Category,
Anonymous = theJournal.Anonymous,
IsOpen = theJournal.IsOpen,
Score = theJournal.Score,
ScoreAcc = theJournal.ScoreAcc,