feat: add mentorship assignments and peer review enhancements
- Create `mentorship_assignments` table with relevant fields and indexes. - Add `peer_review_settings` table for lesson-specific peer review configurations. - Enhance `peer_reviews` and `course_submissions` tables with additional fields for instructor reviews and final scores. - Implement My Notes page to display user annotations with delete functionality. - Create Lesson Annotations component for managing notes with editing and deletion capabilities. - Develop Mentor Panel component to display mentor and mentee information. - Add Course Mentorships page for assigning mentors to students with modal for selection. Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
-- Fase 41-B: Anotaciones Privadas en Lecciones
|
||||
CREATE TABLE IF NOT EXISTS lesson_annotations (
|
||||
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
user_id UUID NOT NULL,
|
||||
lesson_id UUID NOT NULL,
|
||||
organization_id UUID NOT NULL,
|
||||
course_id UUID NOT NULL,
|
||||
content TEXT NOT NULL,
|
||||
-- JSON libre: { "type": "timestamp", "value": 42.5 } | { "type": "scroll", "value": 0.35 }
|
||||
position_data JSONB,
|
||||
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
||||
updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
|
||||
);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS idx_lesson_annotations_user_lesson
|
||||
ON lesson_annotations (user_id, lesson_id);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS idx_lesson_annotations_user_org
|
||||
ON lesson_annotations (user_id, organization_id);
|
||||
@@ -0,0 +1,15 @@
|
||||
CREATE TABLE IF NOT EXISTS mentorship_assignments (
|
||||
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
organization_id UUID NOT NULL,
|
||||
course_id UUID NOT NULL,
|
||||
mentor_id UUID NOT NULL REFERENCES users(id) ON DELETE CASCADE,
|
||||
student_id UUID NOT NULL REFERENCES users(id) ON DELETE CASCADE,
|
||||
assigned_by UUID NOT NULL, -- instructor que realizó la asignación
|
||||
notes TEXT, -- notas internas del instructor
|
||||
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
||||
UNIQUE (course_id, mentor_id, student_id)
|
||||
);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS idx_mentorship_course ON mentorship_assignments (course_id, organization_id);
|
||||
CREATE INDEX IF NOT EXISTS idx_mentorship_mentor ON mentorship_assignments (mentor_id, organization_id);
|
||||
CREATE INDEX IF NOT EXISTS idx_mentorship_student ON mentorship_assignments (student_id, organization_id);
|
||||
@@ -0,0 +1,31 @@
|
||||
-- Fase 41-F: Evaluación entre Pares Mejorada
|
||||
|
||||
-- Configuración de peer review por lección
|
||||
CREATE TABLE IF NOT EXISTS peer_review_settings (
|
||||
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
lesson_id UUID NOT NULL UNIQUE REFERENCES lessons(id) ON DELETE CASCADE,
|
||||
organization_id UUID NOT NULL,
|
||||
required_reviews INT NOT NULL DEFAULT 2, -- cuántas revisiones necesita cada entrega
|
||||
peer_weight INT NOT NULL DEFAULT 70, -- 0-100: peso del promedio de pares en la nota final
|
||||
instructor_weight INT NOT NULL DEFAULT 30, -- 0-100: peso de la calificación del instructor
|
||||
rubric_id UUID, -- rúbrica externa (CMS) para orientar la evaluación
|
||||
auto_assign BOOLEAN NOT NULL DEFAULT true, -- asignación automática al entregar
|
||||
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
||||
updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
||||
CONSTRAINT peer_weights_sum CHECK (peer_weight + instructor_weight = 100)
|
||||
);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS idx_peer_review_settings_lesson ON peer_review_settings (lesson_id);
|
||||
|
||||
-- Calificación del instructor sobre una entrega
|
||||
ALTER TABLE peer_reviews
|
||||
ADD COLUMN IF NOT EXISTS is_instructor_review BOOLEAN NOT NULL DEFAULT false;
|
||||
|
||||
-- Calificación final calculada (desnormalizada para eficiencia)
|
||||
ALTER TABLE course_submissions
|
||||
ADD COLUMN IF NOT EXISTS final_score FLOAT, -- NULL mientras no esté completo
|
||||
ADD COLUMN IF NOT EXISTS review_count INT NOT NULL DEFAULT 0,
|
||||
ADD COLUMN IF NOT EXISTS status TEXT NOT NULL DEFAULT 'pending';
|
||||
-- status: 'pending' | 'under_review' | 'graded'
|
||||
|
||||
CREATE INDEX IF NOT EXISTS idx_course_submissions_status ON course_submissions (lesson_id, status);
|
||||
Reference in New Issue
Block a user