Commit c20ca40fac3ba7e4f0e1e56aede19ed650b03747
1 parent
9189a442
Exists in
master
Adicionado nota necessária exame no diário
portabilis/ieducar#96
Showing
4 changed files
with
61 additions
and
6 deletions
Show diff stats
ieducar/modules/Avaliacao/Assets/Javascripts/Diario.js
... | ... | @@ -624,6 +624,15 @@ function notaExameField(matriculaId, componenteCurricularId, value) { |
624 | 624 | value); |
625 | 625 | } |
626 | 626 | |
627 | +function notaNecessariaField(matriculaId, componenteCurricularId, value){ | |
628 | + if (value=='' || value==undefined) value = '-'; | |
629 | + var $notaNecessariaField = $j('<span />').addClass('nn-matricula-cc') | |
630 | + .addClass('nn-matricula-' + matriculaId + '-cc') | |
631 | + .attr('id', 'nn-matricula-' + matriculaId + '-cc-' + componenteCurricularId) | |
632 | + .text(value); | |
633 | + setNextTabIndex($notaNecessariaField); | |
634 | + return $j('<td />').html($notaNecessariaField).addClass('center'); | |
635 | +} | |
627 | 636 | |
628 | 637 | function faltaField(matriculaId, componenteCurricularId, value) { |
629 | 638 | var $faltaField = $j('<input />').addClass('falta-matricula-cc') |
... | ... | @@ -676,10 +685,17 @@ function updateComponenteCurricular($targetElement, matriculaId, cc) { |
676 | 685 | if ($tableSearchDetails.data('details').quantidade_etapas == $j('#etapa').val()) { |
677 | 686 | var $fieldNotaExame = notaExameField(matriculaId, cc.id, cc.nota_exame); |
678 | 687 | |
679 | - if (cc.nota_exame == '' && safeToLowerCase(cc.situacao) != 'em exame') | |
688 | + var $fieldNN = notaNecessariaField(matriculaId, cc.id, cc.nota_necessaria_exame); | |
689 | + | |
690 | + if (cc.nota_exame == '' && safeToLowerCase(cc.situacao) != 'em exame'){ | |
680 | 691 | $fieldNotaExame.children().hide(); |
692 | + $fieldNN.children().text('-'); | |
693 | + } | |
681 | 694 | |
682 | 695 | $fieldNotaExame.appendTo($targetElement); |
696 | + | |
697 | + // Adiciona campo com nota necessária | |
698 | + $fieldNN.appendTo($targetElement); | |
683 | 699 | } |
684 | 700 | |
685 | 701 | } |
... | ... | @@ -699,8 +715,10 @@ function updateComponenteCurricularHeaders($targetElement, $tagElement) { |
699 | 715 | if (useNota) { |
700 | 716 | $tagElement.clone().addClass('center').html('Nota').appendTo($targetElement); |
701 | 717 | |
702 | - if ($tableSearchDetails.data('details').quantidade_etapas == $j('#etapa').val()) | |
718 | + if ($tableSearchDetails.data('details').quantidade_etapas == $j('#etapa').val()){ | |
703 | 719 | $tagElement.clone().addClass('center').html('Nota exame').appendTo($targetElement); |
720 | + $tagElement.clone().addClass('center').html(safeUtf8Decode('Nota necessária no exame')).appendTo($targetElement); | |
721 | + } | |
704 | 722 | } |
705 | 723 | |
706 | 724 | $tagElement.clone().addClass('center').html('Falta').appendTo($targetElement); |
... | ... | @@ -779,6 +797,7 @@ function updateResourceRow(dataResponse) { |
779 | 797 | |
780 | 798 | var $situacaoField = $j('#situacao-matricula-' + matriculaId + '-cc-' + ccId); |
781 | 799 | var $fieldNotaExame = $j('#nota-exame-matricula-' + matriculaId + '-cc-' + ccId); |
800 | + var $fieldNN = $j('#nn-matricula-' + matriculaId + '-cc-' + ccId); | |
782 | 801 | |
783 | 802 | $situacaoField.html(dataResponse.situacao); |
784 | 803 | colorizeSituacaoTd($situacaoField.closest('td'), dataResponse.situacao); |
... | ... | @@ -788,9 +807,14 @@ function updateResourceRow(dataResponse) { |
788 | 807 | |
789 | 808 | $fieldNotaExame.show(); |
790 | 809 | $fieldNotaExame.focus(); |
810 | + $fieldNN.text(dataResponse.nota_necessaria_exame); | |
791 | 811 | } |
792 | - else if($fieldNotaExame.val() == '' && safeToLowerCase(dataResponse.situacao) != 'em exame') | |
812 | + else if($fieldNotaExame.val() == '' && safeToLowerCase(dataResponse.situacao) != 'em exame'){ | |
793 | 813 | $fieldNotaExame.hide(); |
814 | + $fieldNN.text('-'); | |
815 | + }else{ | |
816 | + $fieldNN.text(dataResponse.nota_necessaria_exame); | |
817 | + } | |
794 | 818 | } |
795 | 819 | |
796 | 820 | function colorizeSituacaoTd(tdElement, situacao) { | ... | ... |
ieducar/modules/Avaliacao/Service/Boletim.php
... | ... | @@ -2269,6 +2269,7 @@ class Avaliacao_Service_Boletim implements CoreExt_Configurable |
2269 | 2269 | */ |
2270 | 2270 | public function preverNotaRecuperacao($id) |
2271 | 2271 | { |
2272 | + /* | |
2272 | 2273 | if (is_null($this->getRegra()->formulaRecuperacao) || !isset($this->_notasComponentes[$id])) { |
2273 | 2274 | return NULL; |
2274 | 2275 | } |
... | ... | @@ -2293,7 +2294,36 @@ class Avaliacao_Service_Boletim implements CoreExt_Configurable |
2293 | 2294 | $data['formulaValues']['E' . $nota->etapa] = $nota->nota; |
2294 | 2295 | } |
2295 | 2296 | |
2296 | - return $this->getRegra()->tabelaArredondamento->predictValue($formula, $data); | |
2297 | + return $this->getRegra()->tabelaArredondamento->predictValue($formula, $data); */ | |
2298 | + | |
2299 | + if (is_null($this->getRegra()->formulaRecuperacao) || !isset($this->_notasComponentes[$id])) { | |
2300 | + return NULL; | |
2301 | + } | |
2302 | + | |
2303 | + $notas = $this->_notasComponentes[$id]; | |
2304 | + | |
2305 | + unset($notas[$this->getOption('etapas')]); | |
2306 | + | |
2307 | + $somaEtapas = array_sum(CoreExt_Entity::entityFilterAttr($notas, 'etapa', 'nota')); | |
2308 | + | |
2309 | + $formula = $this->getRegra()->formulaRecuperacao; | |
2310 | + | |
2311 | + $data = array( | |
2312 | + 'Se' => $somaEtapas, | |
2313 | + 'Et' => $this->getOption('etapas'), | |
2314 | + 'Rc' => NULL ); | |
2315 | + | |
2316 | + foreach ($notas as $nota) { | |
2317 | + $data['E' . $nota->etapa] = $nota->nota; | |
2318 | + } | |
2319 | + | |
2320 | + for($i = 0.1 ; $i<=10; $i+=0.1){ | |
2321 | + $data['Rc']=$i; | |
2322 | + if ($this->getRegra()->formulaRecuperacao->execFormulaMedia($data) >= $this->getRegra()->mediaRecuperacao) | |
2323 | + return $i; | |
2324 | + } | |
2325 | + | |
2326 | + return null; | |
2297 | 2327 | } |
2298 | 2328 | |
2299 | 2329 | /** | ... | ... |
ieducar/modules/Avaliacao/Views/DiarioApiController.php
... | ... | @@ -404,6 +404,7 @@ class DiarioApiController extends ApiCoreController |
404 | 404 | $this->appendResponse('componente_curricular_id', $this->getRequest()->componente_curricular_id); |
405 | 405 | $this->appendResponse('matricula_id', $this->getRequest()->matricula_id); |
406 | 406 | $this->appendResponse('situacao', $this->getSituacaoMatricula()); |
407 | + $this->appendResponse('nota_necessaria_exame', $this->getNotaNecessariaExame($this->getRequest()->componente_curricular_id)); | |
407 | 408 | } |
408 | 409 | |
409 | 410 | |
... | ... | @@ -752,7 +753,7 @@ class DiarioApiController extends ApiCoreController |
752 | 753 | $componente['nome'] = $this->safeString(strtoupper($_componente->get('nome')), false); |
753 | 754 | $componente['nota_atual'] = $this->getNotaAtual($etapa = null, $componente['id']); |
754 | 755 | $componente['nota_exame'] = $this->getNotaExame($componente['id']); |
755 | - //$componente['nota_necessaria_exame'] = $this->getNotaNecessariaExame($componente['id']); | |
756 | + $componente['nota_necessaria_exame'] = ($componente['situacao'] != 'Em andamento' ? $this->getNotaNecessariaExame($componente['id']) : null ); | |
756 | 757 | $componente['falta_atual'] = $this->getFaltaAtual($etapa = null, $componente['id']); |
757 | 758 | $componente['parecer_atual'] = $this->getParecerAtual($componente['id']); |
758 | 759 | $componente['situacao'] = $this->getSituacaoMatricula($componente['id']); | ... | ... |
ieducar/modules/Portabilis/Assets/Version.php