Phase 4: grade comments with frequency-ranked suggestions

- progress comment_templates (tone + use_count) and grade_comments tables;
  setGrade now accepts comments list; templates created/bumped automatically;
  GET /api/v1/comment-templates?q= returns suggestions ranked by frequency
- admin group page: per-grade ✎ dialog (score + editable comment rows with
  tone, datalist suggestions), chips under each score, data-comments JSON attr
- student lab page: score + colored tone chips
- fixed damaged button/attributes from earlier manual template surgery
This commit is contained in:
2026-09-12 01:51:23 +03:00
parent d6fc47794e
commit 76a9a915c2
15 changed files with 305 additions and 18 deletions

View File

@@ -0,0 +1,19 @@
-- Grade comments: reusable templates (frequency-ranked) + per-grade comments.
CREATE TABLE comment_templates (
id uuid PRIMARY KEY DEFAULT uuidv7(),
text text NOT NULL UNIQUE,
tone varchar(8) NOT NULL DEFAULT 'neutral', -- positive | neutral | negative
use_count integer NOT NULL DEFAULT 1
);
CREATE TABLE grade_comments (
id uuid PRIMARY KEY DEFAULT uuidv7(),
student_id uuid NOT NULL,
lab_id uuid NOT NULL,
text text NOT NULL,
tone varchar(8) NOT NULL DEFAULT 'neutral',
created_at timestamptz NOT NULL DEFAULT now()
);
CREATE INDEX grade_comments_grade_idx ON grade_comments (student_id, lab_id);