Commit 1c378916 by Denys Tito

feat(students): agregar fecha de matrícula y sede del aula al documento del alumno

student_enrollment_date (ma_matricula.matricula_fecha) y
student_classroom_branch_id (sede del aula donde asiste, vía ac_aula y
ad_sede) permiten que intranet-so-be resuelva la audiencia de los
comunicados desde la sesión, sin consultas adicionales.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
parent 6607b7ba
......@@ -21,6 +21,8 @@ type Student struct {
CicleID int `bson:"student_cicle_id"`
EnrollmentID int `bson:"enrollment_id"`
EnrollmentPhotoURL *string `bson:"student_enrollment_photo_url"`
EnrollmentDate *time.Time `bson:"student_enrollment_date"`
ClassroomBranchID *int `bson:"student_classroom_branch_id"`
CreatedAt time.Time `bson:"created_at"`
UpdatedAt time.Time `bson:"updated_at"`
RowHash string `bson:"row_hash,omitempty" json:"-"`
......
......@@ -21,7 +21,9 @@ SELECT e.estudiante_id as student_id,
14 as student_period_id,
28 as student_cicle_id,
ma.matricula_id as enrollment_id,
foto.requisito_url as student_enrollment_photo_url
foto.requisito_url as student_enrollment_photo_url,
ma.matricula_fecha as student_enrollment_date,
aula_sede.sede_id as student_classroom_branch_id
FROM matricula.ma_estudiante e
INNER JOIN persona.pe_persona pp ON e.persona_id = pp.persona_id
INNER JOIN general.gn_catalogo_siiaa sexo on pp.sexo_id = sexo.catalogo_siiaa_id
......@@ -30,6 +32,8 @@ FROM matricula.ma_estudiante e
INNER JOIN administracion.ad_sede se on ac.sede_id = se.sede_id
INNER JOIN general.gn_catalogo_siiaa nivel on ac.nivel_id = nivel.catalogo_siiaa_id
INNER JOIN academico.ac_grado grado on ac.grado_id = grado.grado_id
LEFT JOIN academico.ac_aula aula_asiste on aula_asiste.aula_id = ma.aula_id_asiste
LEFT JOIN administracion.ad_sede aula_sede on aula_sede.sede_id = aula_asiste.sede_id
LEFT JOIN LATERAL (SELECT fr.requisito_url
FROM matricula.ma_matricula fm
INNER JOIN matricula.ma_requisito fr ON fr.matricula_id = fm.matricula_id
......
......@@ -60,10 +60,13 @@ func FetchStudentBasics(ctx context.Context, pool *Pool, query string) (map[int]
cicleID int
enrollmentID int
enrollmentPhotoURL *string
enrollmentDate *time.Time
classroomBranchID *int
)
if err := rows.Scan(&studentID, &studentCode, &studentInternalCode, &paternalLastName, &maternalLastName,
&name, &dni, &birthday, &email, &genre, &branch, &level,
&grade, &classroomAttendanceID, &periodID, &cicleID, &enrollmentID, &enrollmentPhotoURL); err != nil {
&grade, &classroomAttendanceID, &periodID, &cicleID, &enrollmentID, &enrollmentPhotoURL,
&enrollmentDate, &classroomBranchID); err != nil {
return nil, nil, fmt.Errorf("scan student row: %w", err)
}
......@@ -86,6 +89,8 @@ func FetchStudentBasics(ctx context.Context, pool *Pool, query string) (map[int]
CicleID: cicleID,
EnrollmentID: enrollmentID,
EnrollmentPhotoURL: enrollmentPhotoURL,
EnrollmentDate: enrollmentDate,
ClassroomBranchID: classroomBranchID,
}
order = append(order, studentID)
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment