fix: normalizar sync de google sheets para todos los dias, reparar 500 en ciclos lectivos, selector de ciclo lectivo en comisiones y opciones --keep-db --keep-users en install.sh
This commit is contained in:
@@ -833,6 +833,7 @@ const handleCommissionsList = async (req, res) => {
|
||||
let commissions = [];
|
||||
let subjects = [];
|
||||
let teachers = [];
|
||||
let academic_terms = [];
|
||||
|
||||
try {
|
||||
const [cRes, uRes] = await Promise.allSettled([
|
||||
@@ -854,6 +855,15 @@ const handleCommissionsList = async (req, res) => {
|
||||
teachers: c.teachers || (c.teacher_name ? [{ name: c.teacher_name, role: 'Titular' }] : [])
|
||||
}));
|
||||
subjects = cRes.value.data.subjects || [];
|
||||
academic_terms = cRes.value.data.academic_terms || [];
|
||||
}
|
||||
|
||||
// Si por alguna razón no vinieron academic_terms en commissions, intentar fallback
|
||||
if (!academic_terms || academic_terms.length === 0) {
|
||||
try {
|
||||
const termsRes = await req.apiClient.get('/academic-terms');
|
||||
academic_terms = termsRes.data?.terms || termsRes.data?.academic_terms || [];
|
||||
} catch (tErr) {}
|
||||
}
|
||||
|
||||
if (uRes.status === 'fulfilled' && uRes.value.data) {
|
||||
@@ -872,6 +882,7 @@ const handleCommissionsList = async (req, res) => {
|
||||
commissions,
|
||||
subjects,
|
||||
teachers,
|
||||
academic_terms,
|
||||
search,
|
||||
subject_filter: subject_id ? parseInt(subject_id, 10) : '',
|
||||
shift_filter: shift,
|
||||
@@ -993,12 +1004,13 @@ const handleCommissionDetail = async (req, res) => {
|
||||
|
||||
const handleCommissionAdd = async (req, res) => {
|
||||
try {
|
||||
const { subject_id, code, semester, year, shift, teacher_id, max_students, schedule, virtual_link } = req.body;
|
||||
const { subject_id, code, semester, year, shift, teacher_id, max_students, schedule, virtual_link, academic_term_id } = req.body;
|
||||
const payload = {
|
||||
subject_id: parseInt(subject_id, 10),
|
||||
code: (code || '').trim(),
|
||||
semester: semester || '1C',
|
||||
year: year ? parseInt(year, 10) : 2026,
|
||||
academic_term_id: academic_term_id ? parseInt(academic_term_id, 10) : null,
|
||||
shift: shift || 'Mañana',
|
||||
teacher_id: teacher_id ? parseInt(teacher_id, 10) : null,
|
||||
max_students: max_students ? parseInt(max_students, 10) : 40,
|
||||
|
||||
Reference in New Issue
Block a user