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
No related branches found
No related tags found
No related merge requests found
...@@ -905,7 +905,7 @@ class SolutionsController extends StudipController ...@@ -905,7 +905,7 @@ class SolutionsController extends StudipController
Sidebar::get()->addWidget($widget); 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'); $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); $element = new SelectElement(0, sprintf(_vips('Aktuelle Version: %s'), $version), !$archived_id);
$widget->addElement($element); $widget->addElement($element);
...@@ -1059,7 +1059,6 @@ class SolutionsController extends StudipController ...@@ -1059,7 +1059,6 @@ class SolutionsController extends StudipController
$solution = new VipsSolution(); $solution = new VipsSolution();
$solution->exercise_id = Request::int('exercise_id'); $solution->exercise_id = Request::int('exercise_id');
$solution->assignment_id = Request::int('assignment_id'); $solution->assignment_id = Request::int('assignment_id');
$solution->time = date('Y-m-d H:i:s');
$solution->user_id = $solver_id; $solution->user_id = $solver_id;
} }
......
...@@ -57,13 +57,15 @@ class VipsAssignmentAttempt extends SimpleORMap ...@@ -57,13 +57,15 @@ class VipsAssignmentAttempt extends SimpleORMap
]; ];
foreach ($solutions as $solution) { foreach ($solutions as $solution) {
$logs[] = [ if ($solution->isSubmitted()) {
'label' => sprintf(_vips('Abgabe Aufgabe %d'), $position[$solution->exercise_id]), $logs[] = [
'time' => $solution->time, 'label' => sprintf(_vips('Abgabe Aufgabe %d'), $position[$solution->exercise_id]),
'ip_address' => $solution->ip_address, 'time' => $solution->time,
'session_id' => $solution->options['session_id'], 'ip_address' => $solution->ip_address,
'archived' => $solution->isArchived(), 'session_id' => $solution->options['session_id'],
]; 'archived' => $solution->isArchived(),
];
}
} }
if ($end_time && $end_time < date('Y-m-d H:i:s')) { if ($end_time && $end_time < date('Y-m-d H:i:s')) {
......
...@@ -104,6 +104,14 @@ class VipsSolution extends SimpleORMap ...@@ -104,6 +104,14 @@ class VipsSolution extends SimpleORMap
return $this->response == $this->exercise->defaultResponse() && count($this->files) == 0; 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) * Return the total number of solutions (including archived ones)
* submitted by the same user for this exercise. * submitted by the same user for this exercise.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment