Track test execution time
This commit is contained in:
@@ -71,7 +71,7 @@ class SetModel extends BaseDatabaseModel
|
||||
)->loadObjectList();
|
||||
}
|
||||
|
||||
public function saveResult(string $participantName, int $extraTime, array $result): bool
|
||||
public function saveResult(string $participantName, int $extraTime, int $startedAt, array $result): bool
|
||||
{
|
||||
$db = Factory::getContainer()->get('DatabaseDriver');
|
||||
$setId = $this->getSetId();
|
||||
@@ -84,6 +84,8 @@ class SetModel extends BaseDatabaseModel
|
||||
$row = (object) [
|
||||
'set_id' => $setId,
|
||||
'participant_name' => trim($participantName),
|
||||
'started' => $startedAt > 0 ? gmdate('Y-m-d H:i:s', $startedAt) : null,
|
||||
'execution_time' => $startedAt > 0 ? max(0, time() - $startedAt) : 0,
|
||||
'extra_time' => max(0, $extraTime),
|
||||
'correct_count' => (int) ($result['correct'] ?? 0),
|
||||
'total_count' => (int) ($result['total'] ?? 0),
|
||||
|
||||
@@ -34,6 +34,7 @@ class HtmlView extends BaseHtmlView
|
||||
$this->getModel()->saveResult(
|
||||
$input->post->getString('participant_name', ''),
|
||||
$input->post->getInt('extra_time', 0),
|
||||
$input->post->getInt('test_started_at', 0),
|
||||
$this->results
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user