From 44edd5903ecbe053b2636daa35ebf7fdf4594be5 Mon Sep 17 00:00:00 2001 From: Elmar Ludwig <elmar.ludwig@uni-osnabrueck.de> Date: Tue, 18 May 2021 16:22:25 +0200 Subject: [PATCH] allow access to unstartet tests, fixes #61 --- lib/VipsAssignment.php | 2 +- lib/VipsFile.php | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/lib/VipsAssignment.php b/lib/VipsAssignment.php index 6c62f92..1eacae4 100644 --- a/lib/VipsAssignment.php +++ b/lib/VipsAssignment.php @@ -541,7 +541,7 @@ class VipsAssignment extends SimpleORMap $now = date('Y-m-d H:i:s'); - if ($this->isFinished() && $this->getAssignmentAttempt($user_id) || + if ($this->isFinished() && ($this->type === 'practice' || $this->getAssignmentAttempt($user_id)) || $this->isSelfAssessment() && $this->getUserEndTime($user_id) < $now) { if ($this->type === 'exam' || $this->options['released'] >= 3) { return $this->options['released']; diff --git a/lib/VipsFile.php b/lib/VipsFile.php index 5c43ff0..89e01cc 100644 --- a/lib/VipsFile.php +++ b/lib/VipsFile.php @@ -155,4 +155,20 @@ class VipsFile extends SimpleORMap { return strpos($this->mime_type, 'image/') === 0; } + + /** + * Determine if this file references an audio file. + */ + public function isAudio() + { + return strpos($this->mime_type, 'audio/') === 0; + } + + /** + * Determine if this file references a video file. + */ + public function isVideo() + { + return strpos($this->mime_type, 'video/') === 0; + } } -- GitLab