Add rating field to entries (1-10 scale) with UI display and module averages

This commit is contained in:
dev
2026-12-05 17:33:37 +03:00
parent df721c13f2
commit 84ca5a3d8c
4 changed files with 31 additions and 6 deletions
-5
View File
@@ -407,11 +407,6 @@ DO $$ BEGIN
ALTER TABLE entries ADD CONSTRAINT entries_rating_check CHECK (rating BETWEEN 1 AND 10);
EXCEPTION WHEN duplicate_object THEN NULL; END $$;
CREATE INDEX IF NOT EXISTS idx_entries_module_id ON entries(module_id);
UPDATE entries
SET rating = (7 + mod(abs(hashtext(to_char(created_at AT TIME ZONE 'UTC', 'YYYYMMDDHH24MISSMS'))::bigint), 4))::smallint
WHERE module_id IS NOT NULL
AND created_at IS NOT NULL
AND rating IS NULL;
CREATE TABLE IF NOT EXISTS student_photos (
id SERIAL PRIMARY KEY,