build: forçando atualização do sistema de notas
This commit is contained in:
parent
4119dc12f4
commit
5d1e7876be
|
|
@ -0,0 +1,37 @@
|
||||||
|
import pg from 'pg';
|
||||||
|
const DATABASE_URL = 'postgresql://edumanager:EduManager2026!Seguro@localhost:5432/edumanager';
|
||||||
|
const pool = new pg.Pool({ connectionString: DATABASE_URL });
|
||||||
|
|
||||||
|
async function checkExams() {
|
||||||
|
try {
|
||||||
|
const { rows } = await pool.query('SELECT data FROM school_data WHERE id = 1');
|
||||||
|
const data = rows[0]?.data || {};
|
||||||
|
const exams = data.exams || [];
|
||||||
|
|
||||||
|
const pastaExam = exams.find(e => e.title && e.title.includes('Pastas'));
|
||||||
|
|
||||||
|
if (pastaExam) {
|
||||||
|
console.log('--- Atividade Encontrada ---');
|
||||||
|
console.log('Título:', pastaExam.title);
|
||||||
|
console.log('ID:', pastaExam.id);
|
||||||
|
console.log('subjectId:', pastaExam.subjectId);
|
||||||
|
console.log('periodId:', pastaExam.periodId);
|
||||||
|
console.log('Status:', pastaExam.status);
|
||||||
|
|
||||||
|
if (!pastaExam.subjectId || !pastaExam.periodId) {
|
||||||
|
console.log('❌ ALERTA: Esta atividade está DESCONECTADA (sem subjectId ou periodId).');
|
||||||
|
} else {
|
||||||
|
console.log('✅ OK: Esta atividade está vinculada corretamente.');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
console.log('❌ Atividade "Pastas" não encontrada no school_data.');
|
||||||
|
console.log('Títulos disponíveis:', exams.map(e => e.title));
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (err) {
|
||||||
|
console.error('Erro na verificação:', err.message);
|
||||||
|
} finally {
|
||||||
|
await pool.end();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
checkExams();
|
||||||
|
|
@ -0,0 +1,20 @@
|
||||||
|
import pg from 'pg';
|
||||||
|
const DATABASE_URL = 'postgresql://edumanager:EduManager2026!Seguro@localhost:5432/edumanager';
|
||||||
|
const pool = new pg.Pool({ connectionString: DATABASE_URL });
|
||||||
|
|
||||||
|
async function check() {
|
||||||
|
try {
|
||||||
|
const { rows: notas } = await pool.query('SELECT count(*) FROM notas_boletim');
|
||||||
|
console.log('Notas count in table:', notas[0].count);
|
||||||
|
|
||||||
|
const { rows: sd } = await pool.query('SELECT data FROM school_data WHERE id = 1');
|
||||||
|
const data = sd[0]?.data || {};
|
||||||
|
console.log('Grades count in JSON:', data.grades?.length || 0);
|
||||||
|
|
||||||
|
} catch (err) {
|
||||||
|
console.error('Error during check:', err.message);
|
||||||
|
} finally {
|
||||||
|
await pool.end();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
check();
|
||||||
|
|
@ -0,0 +1,29 @@
|
||||||
|
import pg from 'pg';
|
||||||
|
const DATABASE_URL = 'postgresql://edumanager:EduManager2026!Seguro@127.0.0.1:5432/edumanager';
|
||||||
|
const pool = new pg.Pool({ connectionString: DATABASE_URL });
|
||||||
|
|
||||||
|
async function debug() {
|
||||||
|
try {
|
||||||
|
const { rows: schoolRows } = await pool.query('SELECT data FROM school_data WHERE id = 1');
|
||||||
|
const data = schoolRows[0]?.data || {};
|
||||||
|
const sidney = (data.students || []).find(s => s.name && s.name.includes('Sidney'));
|
||||||
|
|
||||||
|
if (!sidney) {
|
||||||
|
console.log('Sidney não encontrado no JSON.');
|
||||||
|
} else {
|
||||||
|
console.log('ID do Sidney:', sidney.id);
|
||||||
|
const { rows: notas } = await pool.query('SELECT * FROM notas_boletim WHERE aluno_id = $1', [sidney.id]);
|
||||||
|
console.log('Notas na tabela SQL:', notas.length);
|
||||||
|
console.log(JSON.stringify(notas, null, 2));
|
||||||
|
}
|
||||||
|
|
||||||
|
const { rows: allNotas } = await pool.query('SELECT count(*) FROM notas_boletim');
|
||||||
|
console.log('Total de notas na tabela SQL:', allNotas[0].count);
|
||||||
|
|
||||||
|
} catch (err) {
|
||||||
|
console.error('ERRO:', err.message);
|
||||||
|
} finally {
|
||||||
|
await pool.end();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
debug();
|
||||||
Loading…
Reference in New Issue