Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
grady
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Grady Corp.
grady
Commits
43a665b1
Commit
43a665b1
authored
1 week ago
by
Linus Keiser
Browse files
Options
Downloads
Patches
Plain Diff
--wip--
parent
cee98a2c
No related branches found
No related tags found
No related merge requests found
Pipeline
#591805
failed
1 week ago
Stage: build
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
db/schema/schema.surql
+44
-10
44 additions, 10 deletions
db/schema/schema.surql
with
44 additions
and
10 deletions
db/schema/schema.surql
+
44
−
10
View file @
43a665b1
...
...
@@ -57,25 +57,59 @@ DEFINE FIELD final ON evaluation TYPE bool DEFAULT false PERMISSIONS FULL;
-- NOTE: making this an edge between evaluation->submission seems overkill
-- NOTE: but maybe make this a record reference? (https://surrealdb.com/docs/surrealql/datamodel/references)
-- DEFINE FIELD annotations ON evaluation TYPE array<record<annotation>> DEFAULT [] PERMISSIONS FULL;
DEFINE FIELD annotations ON evaluation TYPE array<object> DEFAULT [] PERMISSIONS FULL;
-- DEFINE FIELD annotations ON evaluation TYPE array<record<annotation>> DEFAULT [] PERMISSIONS FULL;
DEFINE FIELD maxScore ON evaluation READONLY VALUE out.out.full_score PERMISSIONS FULL;
DEFINE FIELD postDeltaScore ON evaluation READONLY VALUE <future> {
LET $scoreSum: float = <-annotation[WHERE $this.meta.scoreDelta].meta.scoreDelta.fold(0, |$a: any, $b: any| $a + $b);
LET $meta = IF $scoreSum < 0
{ {
reason: 'Negative',
valid: false
} }
ELSE IF $scoreSum > maxScore
{ {
reason: string::concat('Too high (max: ', ' ', maxScore, ')'),
valid: false
} }
ELSE
{ {
valid: true
} }
;
RETURN {
meta: $meta,
score: $scoreSum
};
}
PERMISSIONS FULL
;
DEFINE INDEX one_per_submission ON evaluation FIELDS out UNIQUE;
-- DEFINE EVENT ...
-- TODO scoreDelta event
-- NOTE: it might be better to just have a future which calculates after-score-delta score?
-- DEFINE EVENT OVERWRITE annotationsChanged ON evaluation WHEN $before.annotations != $after.annotations THEN {
-- LET $beforeScoreDelta = $before.annotations[? $this.meta.scoreDelta].meta.scoreDelta.fold(0, |$a, $b| $a + $b);
-- LET $afterScoreDelta = $after.annotations[? $this.meta.scoreDelta].meta.scoreDelta.fold(0, |$a, $b| $a + $b);
-- TODO check that score + scoreDelta is within bounds!
-- CREATE log SET time = time::now(), beforeScoreDelta = $beforeScoreDelta, afterScoreDelta = $afterScoreDelta;
--};
-- ------------------------------
-- TABLE: annotation
-- ------------------------------
-- DEFINE TABLE annotation TYPE NORMAL SCHEMALESS PERMISSIONS NONE;
-- DEFINE FIELD color ON annotation TYPE option<string> PERMISSIONS FULL;
-- DEFINE FIELD content ON annotation TYPE string PERMISSIONS FULL;
-- TODO data schema for position
-- * can apply to a range (or ranges?) in the text source of the submission, shown at the range it applies to, OR
-- * can apply to the submission as a whole, shown in a dedicated window/list/view on the submission
-- DEFINE FIELD
DEFINE TABLE annotation TYPE RELATION IN tutor | reviewer OUT evaluation SCHEMALESS PERMISSIONS NONE;
DEFINE FIELD type ON annotation TYPE "document" | "line" | "range" PERMISSIONS FULL;
DEFINE FIELD content ON annotation TYPE string PERMISSIONS FULL;
-- DEFINE FIELD meta.author ON annotation TYPE record<tutor> PERMISSIONS FULL;
DEFINE FIELD meta.scoreDelta ON annotation TYPE option<float> PERMISSIONS FULL;
DEFINE FIELD time.created_at ON annotation TYPE datetime DEFAULT time::now() PERMISSIONS FULL;
DEFINE FIELD time.updated_at ON annotation TYPE datetime VALUE time::now() PERMISSIONS FULL;
-- ------------------------------
-- TABLE: exercise_group
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment