Skip to content

Commit

Permalink
Merge pull request #102 from marcosoliveirasoares94/fix/boletim-escolar
Browse files Browse the repository at this point in the history
[2.6] Exibe parecer descritivo no boletim escolar
  • Loading branch information
edersoares authored Aug 2, 2022
2 parents fdbe3a8 + f8e99ff commit 0cd8e35
Show file tree
Hide file tree
Showing 2 changed files with 100 additions and 107 deletions.
23 changes: 8 additions & 15 deletions ieducar/Queries/GeneralOpinionsTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,43 +41,39 @@ protected function query()
(
CASE
WHEN fa.tipo_falta = 1 THEN
(SELECT SUM(fg.quantidade) FROM modules.falta_geral AS fg WHERE fg.falta_aluno_id = fa.id AND fg.etapa = '$etapa')
(SELECT SUM(fg.quantidade) FROM modules.falta_geral AS fg WHERE fg.falta_aluno_id = fa.id)
WHEN fa.tipo_falta = 2 THEN
(SELECT SUM(fcc.quantidade) FROM modules.falta_componente_curricular AS fcc WHERE fcc.falta_aluno_id = fa.id AND fcc.etapa = '$etapa')
(SELECT SUM(fcc.quantidade) FROM modules.falta_componente_curricular AS fcc WHERE fcc.falta_aluno_id = fa.id)
END
)
) AS falta,
modules.frequencia_da_matricula(m.cod_matricula) AS frequencia,
(
SELECT CASE
WHEN (SELECT padrao_ano_escolar FROM pmieducar.curso c WHERE cod_curso = curso.cod_curso) = 1 THEN
('$etapa'||'º '||(
(
SELECT
modulo.nm_tipo
CONCAT(padrao.sequencial, 'º ', modulo.nm_tipo)
FROM
pmieducar.ano_letivo_modulo AS padrao,
pmieducar.modulo
WHERE
padrao.ref_ano = turma.ano
AND padrao.ref_ref_cod_escola = escola.cod_escola
AND padrao.ref_cod_modulo = modulo.cod_modulo
AND modulo.ativo = 1
AND padrao.sequencial::varchar = '$etapa' LIMIT 1
)
AND modulo.ativo = 1 LIMIT 1
)
ELSE
('$etapa'||'º '||(
(
SELECT
modulo.nm_tipo
CONCAT(tm.sequencial, 'º ', modulo.nm_tipo)
FROM
pmieducar.turma_modulo AS tm,
pmieducar.modulo
WHERE
tm.ref_cod_turma = turma.cod_turma
AND tm.ref_cod_modulo = modulo.cod_modulo
AND modulo.ativo = 1
AND tm.sequencial::varchar = '$etapa' LIMIT 1
)
AND modulo.ativo = 1 LIMIT 1
)
END
) AS etapa
Expand Down Expand Up @@ -145,18 +141,15 @@ protected function query()
LEFT JOIN
modules.parecer_geral AS pg
ON pg.parecer_aluno_id = pa.id
AND pg.etapa = '$etapa'
LEFT JOIN
modules.falta_aluno AS fa
ON fa.matricula_id = m.cod_matricula
LEFT JOIN
modules.falta_geral AS fg
ON fg.falta_aluno_id = fa.id
AND fg.etapa = '$etapa'
LEFT JOIN
modules.falta_componente_curricular AS fcc
ON fcc.falta_aluno_id = fa.id
AND fcc.etapa = '$etapa'
WHERE
instituicao.cod_instituicao = $instituicao
AND escola.cod_escola = $escola
Expand Down
Loading

0 comments on commit 0cd8e35

Please sign in to comment.