Skip to content

Instantly share code, notes, and snippets.

@thpoiani
Last active July 23, 2017 16:12
Show Gist options
  • Save thpoiani/767576f7ca84bac9bb32 to your computer and use it in GitHub Desktop.
Save thpoiani/767576f7ca84bac9bb32 to your computer and use it in GitHub Desktop.
Exibir média de notas dos alunos do IFSP através do sistema Aurora
var disciplinas = $('tbody:not(:first) tr'),
aluno = $('.tabelaCabecalhoAluno td:first').text(),
total = 0,
media = 0,
count = 0;
function isAprovado(disciplina) {
return $(disciplina).find(':last').text() === 'Aprovado';
}
function getNota(disciplina) {
return +$(disciplina).find(':nth-child(3)').text();
}
disciplinas.each(function(index, disciplina) {
if (isAprovado(disciplina)) {
total += getNota(disciplina);
count++;
}
});
media = total/count;
console.log('A nota média do aluno ' + aluno + ' é: ' + media);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment