-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathprocessdata.html
56 lines (48 loc) · 1.44 KB
/
processdata.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, minimum-scale=1, maximum-scale=1" />
<meta http-equiv="Expires" content="0">
<meta http-equiv="Last-Modified" content="0">
<meta http-equiv="Cache-Control" content="no-cache, mustrevalidate">
<meta http-equiv="Pragma" content="no-cache">
<title>Preprocesamiento de datos</title>
<!-- scripts -->
<script src="./js/config.js"></script>
<script src="./js/jquery-3.3.1.min.js"></script>
</head>
<body>
<script>
createMateriasList = function(){
// Usado para crear comun.json
materias = {};
docentes = [];
n = 0;
total = Config.json_list.length;
Config.json_list.forEach(function(elem){
const file = "Horarios_" + elem.ref + ".json";
$.getJSON(Config.dataPath + file, function(data){
d=data;
data.materias.forEach(function(x){
materias[x.codigo] = x.nombre;
x.cursos.forEach(y => y.docentes.split("-").forEach(z => docentes[z]=true));
});
n++;
if (n == total ){
const materiasList = Object.keys(materias);
const materiasObj = materiasList.map(cod => ({codigo: cod, nombre: materias[cod]}));
$("body").text(JSON.stringify({
materias: materiasObj,
docentes: Object.keys(docentes)
}));
}
});
});
}
$(function(){
createMateriasList();
})
</script>
</body>
</html>