From 847978449179e4de06acad8c43c5f4973e3e48f1 Mon Sep 17 00:00:00 2001 From: Giacomo Colle Date: Fri, 22 Sep 2023 16:52:02 +0200 Subject: [PATCH 1/2] fix: class days hours arrays --- src/app/app.component.ts | 64 ++++++++++++++++++---------------------- 1 file changed, 29 insertions(+), 35 deletions(-) diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 52fc50c..930388e 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -76,6 +76,9 @@ export class AppComponent implements OnInit { term:any; + days = ['lunedì','martedì','mercoledì','giovedì','venerdì']; + hours = ['07h50','08h40','09h30','10h30','11h20','12h10','13h00','13h50','14h40','15h30']; + constructor(private http:HttpClient) { this.courses$ = new Observable(); var tdocentes = new Array(); @@ -221,14 +224,13 @@ export class AppComponent implements OnInit { } this.aulas$ = distinctAulas; - var days = ['lunedì','martedì','mercoledì','giovedì','venerdì']; - var hours = ['07h50','08h40','09h30','10h30','11h20','12h10','13h00','13h50','14h40','15h30']; + var orariotable = new Array(); - hours.forEach(hour => { + this.hours.forEach(hour => { var orariorow = new Array(); - days.forEach(day => { + this.days.forEach(day => { orariorow[day] = "" }); orariotable[hour] = orariorow; @@ -247,17 +249,15 @@ export class AppComponent implements OnInit { var fleziones = this.leziones$.filter((element)=>{return element.DOC_COGN_NOME1 === cogn_nome || element.DOC_COGN_NOME2 === cogn_nome}); - //var days = {'lunedì':"",'martedì':"",'mercoledì':"",'giovedì':"",'venerdì':"",'sabato':""}; - //var orariotable = {'07h50':days,'08h40':days,'09h30':days,'10h30':days,'11h20':days,'12h10':days,'13h30':days,'14h20':days,'15h20':days,'16h10':days}; - - var days = ['lunedì','martedì','mercoledì','giovedì','venerdì']; - var hours = ['07h50','08h40','09h30','10h30','11h20','12h10','13h00','13h50','14h40','15h30']; + //var this.days = {'lunedì':"",'martedì':"",'mercoledì':"",'giovedì':"",'venerdì':"",'sabato':""}; + //var orariotable = {'07h50':this.days,'08h40':this.days,'09h30':this.days,'10h30':this.days,'11h20':this.days,'12h10':this.days,'13h30':this.days,'14h20':this.days,'15h20':this.days,'16h10':this.days}; + var orariotable = new Array(); - hours.forEach(hour => { + this.hours.forEach(hour => { var orariorow = new Array(); - days.forEach(day => { + this.days.forEach(day => { orariorow[day] = {DURATA:"0"}; }); orariotable[hour] = orariorow; @@ -269,11 +269,11 @@ export class AppComponent implements OnInit { orariotable[element.O_INIZIO][element.GIORNO]["DURATA"]= element.DURATA.charAt(0); switch (element.DURATA.charAt(0)){ case "2": - delete orariotable[hours[hours.indexOf(element.O_INIZIO)+1]][element.GIORNO]; + delete orariotable[this.hours[this.hours.indexOf(element.O_INIZIO)+1]][element.GIORNO]; break; case "3": - delete orariotable[hours[hours.indexOf(element.O_INIZIO)+1]][element.GIORNO]; - delete orariotable[hours[hours.indexOf(element.O_INIZIO)+2]][element.GIORNO]; + delete orariotable[this.hours[this.hours.indexOf(element.O_INIZIO)+1]][element.GIORNO]; + delete orariotable[this.hours[this.hours.indexOf(element.O_INIZIO)+2]][element.GIORNO]; break; } }catch(e){ @@ -290,17 +290,14 @@ export class AppComponent implements OnInit { var fleziones = this.leziones$.filter((element)=>{return element.CLASSE1 === classe || element.CLASSE2 === classe}); - //var days = {'lunedì':"",'martedì':"",'mercoledì':"",'giovedì':"",'venerdì':"",'sabato':""}; - //var orariotable = {'07h50':days,'08h40':days,'09h30':days,'10h30':days,'11h20':days,'12h10':days,'13h30':days,'14h20':days,'15h20':days,'16h10':days}; - - var days = ['lunedì','martedì','mercoledì','giovedì','venerdì']; - var hours = ['07h50','08h40','09h30','10h30','11h20','12h10','13h00','13h50','14h40','15h30']; - + //var this.days = {'lunedì':"",'martedì':"",'mercoledì':"",'giovedì':"",'venerdì':"",'sabato':""}; + //var orariotable = {'07h50':this.days,'08h40':this.days,'09h30':this.days,'10h30':this.days,'11h20':this.days,'12h10':this.days,'13h30':this.days,'14h20':this.days,'15h20':this.days,'16h10':this.days}; + var orariotable = new Array(); - hours.forEach(hour => { + this.hours.forEach(hour => { var orariorow = new Array(); - days.forEach(day => { + this.days.forEach(day => { orariorow[day] = {DURATA:"0"}; }); orariotable[hour] = orariorow; @@ -311,11 +308,11 @@ export class AppComponent implements OnInit { orariotable[element.O_INIZIO][element.GIORNO]["DURATA"]= element.DURATA.charAt(0); switch (element.DURATA.charAt(0)){ case "2": - delete orariotable[hours[hours.indexOf(element.O_INIZIO)+1]][element.GIORNO]; + delete orariotable[this.hours[this.hours.indexOf(element.O_INIZIO)+1]][element.GIORNO]; break; case "3": - delete orariotable[hours[hours.indexOf(element.O_INIZIO)+1]][element.GIORNO]; - delete orariotable[hours[hours.indexOf(element.O_INIZIO)+2]][element.GIORNO]; + delete orariotable[this.hours[this.hours.indexOf(element.O_INIZIO)+1]][element.GIORNO]; + delete orariotable[this.hours[this.hours.indexOf(element.O_INIZIO)+2]][element.GIORNO]; break; } }); @@ -330,17 +327,14 @@ export class AppComponent implements OnInit { var fleziones = this.leziones$.filter((element)=>{return element.AULA1 === aula || element.AULA2 === aula || element.AULA3 === aula }); - //var days = {'lunedì':"",'martedì':"",'mercoledì':"",'giovedì':"",'venerdì':"",'sabato':""}; - //var orariotable = {'07h50':days,'08h40':days,'09h30':days,'10h30':days,'11h20':days,'12h10':days,'13h30':days,'14h20':days,'15h20':days,'16h10':days}; - - var days = ['lunedì','martedì','mercoledì','giovedì','venerdì']; - var hours = ['07h50','08h40','09h30','10h30','11h20','12h10','13h00','13h50','14h40','15h30']; + //var this.days = {'lunedì':"",'martedì':"",'mercoledì':"",'giovedì':"",'venerdì':"",'sabato':""}; + //var orariotable = {'07h50':this.days,'08h40':this.days,'09h30':this.days,'10h30':this.days,'11h20':this.days,'12h10':this.days,'13h30':this.days,'14h20':this.days,'15h20':this.days,'16h10':this.days}; var orariotable = new Array(); - hours.forEach(hour => { + this.hours.forEach(hour => { var orariorow = new Array(); - days.forEach(day => { + this.days.forEach(day => { orariorow[day] = {DURATA:"0"}; }); orariotable[hour] = orariorow; @@ -351,11 +345,11 @@ export class AppComponent implements OnInit { orariotable[element.O_INIZIO][element.GIORNO]["DURATA"]= element.DURATA.charAt(0); switch (element.DURATA.charAt(0)){ case "2": - delete orariotable[hours[hours.indexOf(element.O_INIZIO)+1]][element.GIORNO]; + delete orariotable[this.hours[this.hours.indexOf(element.O_INIZIO)+1]][element.GIORNO]; break; case "3": - delete orariotable[hours[hours.indexOf(element.O_INIZIO)+1]][element.GIORNO]; - delete orariotable[hours[hours.indexOf(element.O_INIZIO)+2]][element.GIORNO]; + delete orariotable[this.hours[this.hours.indexOf(element.O_INIZIO)+1]][element.GIORNO]; + delete orariotable[this.hours[this.hours.indexOf(element.O_INIZIO)+2]][element.GIORNO]; break; } }); From f54f11c7ba464a40c9bb263a762aadb34986c17b Mon Sep 17 00:00:00 2001 From: Giacomo Colle Date: Fri, 22 Sep 2023 17:49:05 +0200 Subject: [PATCH 2/2] fix: scorrimento di tutte le ore e rowspan 1 --- src/app/app.component.html | 5 ++--- src/app/app.component.ts | 18 ++++-------------- src/index.html | 5 +++++ 3 files changed, 11 insertions(+), 17 deletions(-) diff --git a/src/app/app.component.html b/src/app/app.component.html index 2aa5c5d..a0cd3b0 100644 --- a/src/app/app.component.html +++ b/src/app/app.component.html @@ -1,4 +1,3 @@ -

Orario Docenti - Classi - Aule

@@ -70,9 +69,9 @@

{{selitem}}

- + {{ora}} - +
{{orariotable$[ora][giorno]['MAT_COD']}}

diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 930388e..382c90d 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -249,16 +249,12 @@ export class AppComponent implements OnInit { var fleziones = this.leziones$.filter((element)=>{return element.DOC_COGN_NOME1 === cogn_nome || element.DOC_COGN_NOME2 === cogn_nome}); - //var this.days = {'lunedì':"",'martedì':"",'mercoledì':"",'giovedì':"",'venerdì':"",'sabato':""}; - //var orariotable = {'07h50':this.days,'08h40':this.days,'09h30':this.days,'10h30':this.days,'11h20':this.days,'12h10':this.days,'13h30':this.days,'14h20':this.days,'15h20':this.days,'16h10':this.days}; - - var orariotable = new Array(); this.hours.forEach(hour => { var orariorow = new Array(); this.days.forEach(day => { - orariorow[day] = {DURATA:"0"}; + orariorow[day] = {DURATA:"1"}; }); orariotable[hour] = orariorow; }); @@ -290,15 +286,12 @@ export class AppComponent implements OnInit { var fleziones = this.leziones$.filter((element)=>{return element.CLASSE1 === classe || element.CLASSE2 === classe}); - //var this.days = {'lunedì':"",'martedì':"",'mercoledì':"",'giovedì':"",'venerdì':"",'sabato':""}; - //var orariotable = {'07h50':this.days,'08h40':this.days,'09h30':this.days,'10h30':this.days,'11h20':this.days,'12h10':this.days,'13h30':this.days,'14h20':this.days,'15h20':this.days,'16h10':this.days}; - var orariotable = new Array(); this.hours.forEach(hour => { var orariorow = new Array(); this.days.forEach(day => { - orariorow[day] = {DURATA:"0"}; + orariorow[day] = {DURATA:"1"}; }); orariotable[hour] = orariorow; }); @@ -326,16 +319,13 @@ export class AppComponent implements OnInit { this.selitem = aula; var fleziones = this.leziones$.filter((element)=>{return element.AULA1 === aula || element.AULA2 === aula || element.AULA3 === aula }); - - //var this.days = {'lunedì':"",'martedì':"",'mercoledì':"",'giovedì':"",'venerdì':"",'sabato':""}; - //var orariotable = {'07h50':this.days,'08h40':this.days,'09h30':this.days,'10h30':this.days,'11h20':this.days,'12h10':this.days,'13h30':this.days,'14h20':this.days,'15h20':this.days,'16h10':this.days}; - + var orariotable = new Array(); this.hours.forEach(hour => { var orariorow = new Array(); this.days.forEach(day => { - orariorow[day] = {DURATA:"0"}; + orariorow[day] = {DURATA:"1"}; }); orariotable[hour] = orariorow; }); diff --git a/src/index.html b/src/index.html index 23add5e..527425b 100644 --- a/src/index.html +++ b/src/index.html @@ -8,6 +8,11 @@ +
+ +