diff --git a/lib/models/Grading/Instance.php b/lib/models/Grading/Instance.php
index 14ab25a8c4c46767fe19b35bf08c0f4f03083c25..7f362d346e329dae9aedbead8737cc2e93b31b1c 100644
--- a/lib/models/Grading/Instance.php
+++ b/lib/models/Grading/Instance.php
@@ -66,4 +66,22 @@ class Instance extends \SimpleORMap
 
         return self::findBySql('definition_id IN (?) AND user_id = ?', [$definitionIds, $user->id]);
     }
+
+    /**
+     * setter for the rawgrade column. The database type is decimal(6,5) UNSIGNED, therefore
+     * the setter mimics the database behaviour to get valid results from ::isFieldDirty()
+     *
+     * @param mixed $grade
+     * @return string
+     */
+    public function setRawgrade($grade = 0): string
+    {
+        if ($grade < 0) {
+            $grade = 0;
+        }
+        if ($grade >= 10) {
+            $grade = 9.99999;
+        }
+        return $this->content['rawgrade'] = number_format($grade, 5, '.', '');
+    }
 }