Skip to content
Snippets Groups Projects
Commit 39f4f155 authored by Elmar Ludwig's avatar Elmar Ludwig
Browse files

don't display dummy solutions in logs, fixes #64

parent 13037ce8
Branches
Tags
No related merge requests found
......@@ -905,7 +905,7 @@ class SolutionsController extends StudipController
Sidebar::get()->addWidget($widget);
$widget = new SelectWidget(_vips('Versionen'), $this->url_for('solutions/edit_solution', compact('assignment_id', 'exercise_id', 'solver_id', 'view')), 'solution_id');
$version = $solution->id ? date('d.m.Y, H:i', strtotime($solution->time)) : _vips('nicht abgegeben');
$version = $solution->isSubmitted() ? date('d.m.Y, H:i', strtotime($solution->time)) : _vips('nicht abgegeben');
$element = new SelectElement(0, sprintf(_vips('Aktuelle Version: %s'), $version), !$archived_id);
$widget->addElement($element);
......@@ -1059,7 +1059,6 @@ class SolutionsController extends StudipController
$solution = new VipsSolution();
$solution->exercise_id = Request::int('exercise_id');
$solution->assignment_id = Request::int('assignment_id');
$solution->time = date('Y-m-d H:i:s');
$solution->user_id = $solver_id;
}
......
......@@ -57,6 +57,7 @@ class VipsAssignmentAttempt extends SimpleORMap
];
foreach ($solutions as $solution) {
if ($solution->isSubmitted()) {
$logs[] = [
'label' => sprintf(_vips('Abgabe Aufgabe %d'), $position[$solution->exercise_id]),
'time' => $solution->time,
......@@ -65,6 +66,7 @@ class VipsAssignmentAttempt extends SimpleORMap
'archived' => $solution->isArchived(),
];
}
}
if ($end_time && $end_time < date('Y-m-d H:i:s')) {
$logs[] = [
......
......@@ -104,6 +104,14 @@ class VipsSolution extends SimpleORMap
return $this->response == $this->exercise->defaultResponse() && count($this->files) == 0;
}
/**
* Check if this solution has been submitted (is not a dummy solution).
*/
public function isSubmitted()
{
return $this->id && $this->time !== '0000-00-00 00:00:00';
}
/**
* Return the total number of solutions (including archived ones)
* submitted by the same user for this exercise.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment