Last active
August 29, 2015 14:15
-
-
Save henocdz/c9f6c15f181df5082b67 to your computer and use it in GitHub Desktop.
Obtener promedio general de la carrera. Kardex - Institupo Politecnico Nacional
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Obtener promedio general de la carrera. Kardex - Institupo Politecnico Nacional | |
| $(function(){ | |
| var kardex = {} | |
| var container = $('#ctl00_mainCopy_Panel1'); | |
| var tables = container.find('table'); | |
| tables.each(function(i, table){ | |
| // console.log('table', el); | |
| var tbody = $(table).find('tbody'); | |
| tbody.each(function(j, tbody){ | |
| // console.log('tbody', tbody); | |
| var trs = $(tbody).children('tr'); | |
| trs.each(function(k, tr){ | |
| // console.log('tr', e); | |
| if(k < 2) return; // Primeros dos `tr` | |
| var tr = $(tr); | |
| var tds = tr.children('td'); | |
| // console.log('td', ); | |
| if(tds.length < 5) return false; | |
| var materia = $(tds[1]).text(); | |
| var calificacion = $(tds[5]).text(); | |
| kardex[materia] = parseFloat(calificacion); | |
| }); | |
| }); | |
| }); | |
| var materias = 0, | |
| calificaciones = 0; | |
| //Calificaciones futuras: | |
| // kardex['x1'] = 7; | |
| for(var o in kardex){ | |
| materias++; | |
| calificaciones += kardex[o]; | |
| } | |
| console.log("Promedio: ", (calificaciones / materias)); | |
| }); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment