]> git.localhorst.tv Git - alttp.git/blobdiff - app/Models/Result.php
log aosr seed generation errors
[alttp.git] / app / Models / Result.php
index cdb86c77798fb2bccb204c740ee0ced94473bf71..99f3791eacfc951acabb8d69d22053f592adbc80 100644 (file)
@@ -11,6 +11,13 @@ class Result extends Model
        use HasFactory;
 
 
+       public function formatTime() {
+               $hours = floor($this->time / 60 / 60);
+               $minutes = floor(($this->time / 60) % 60);
+               $seconds = floor($this->time % 60);
+               return sprintf('%d:%02d:%02d', $hours, $minutes, $seconds);
+       }
+
        public function updateResult($time, $forfeit) {
                $this->time = $time;
                $this->forfeit = $forfeit;
@@ -43,6 +50,11 @@ class Result extends Model
        }
 
 
+       protected $casts = [
+               'forfeit' => 'boolean',
+               'time' => 'double',
+       ];
+
        protected $appends = [
                'has_finished',
        ];