Improve agenda load time

This commit is contained in:
Peter Maquiran
2021-05-05 19:58:24 +01:00
parent 96bd20e645
commit 0ede8c4607
+18 -15
View File
@@ -383,7 +383,7 @@ export class AgendaPage implements OnInit {
let top = '0';
console.log('startMinutos', startMinutos);
// console.log('startMinutos', startMinutos);
if(startHours < endHours){
if (startMinutos != 0 ){
@@ -494,9 +494,6 @@ export class AgendaPage implements OnInit {
const startHoursOtherFormate = new Date(element.StartDate).getHours().toLocaleString()+':'+new Date(element.StartDate).getMinutes().toLocaleString();
const EndHoursOtherFormate = formatDate(new Date(element.EndDate), 'HH:mm', 'pt');
if( profile =='md' && eventIndex==3){
console.log('mdEvent:', element,eventIndex);
}
events.push({
title: this.timeLineTemplate(startHours, element.Location, element.Body, element.CalendarName, element.Subject,startHoursOtherFormate,EndHoursOtherFormate, eventIndex, profile),
@@ -623,7 +620,7 @@ export class AgendaPage implements OnInit {
case "Pessoal":
//Inicializa o array eventSource
this.eventSource=[];
if(this.profile == "mdgpr") {
this.eventService.getAllMdEvents(momentG(new Date(startTime),'yyyy-MM-dd HH:mm:ss'), momentG(new Date(endTime),'yyyy-MM-dd 23:59:59')).subscribe(response => {
@@ -699,7 +696,6 @@ export class AgendaPage implements OnInit {
case "Oficial":
//Inicializa o array eventSource
this.eventSource=[];
this.eventsListOficial = [];
if(this.profile == "mdgpr") {
@@ -775,8 +771,8 @@ export class AgendaPage implements OnInit {
//this.showTimelinePR = false;
//this.showTimelineMD = false;
// calendar
// calendar
let counter = 0;
this.eventService.getAllMdEvents( momentG(new Date(startTime),'yyyy-MM-dd HH:mm:ss'), momentG(new Date(endTime),'yyyy-MM-dd 23:59:59') ).subscribe(
response => {
@@ -791,7 +787,7 @@ export class AgendaPage implements OnInit {
this.eventsList = response;
}
this.eventSource=[];
this.eventSource= this.eventSource.filter(e => e.profile != 'md');
// loop
this.eventsList.forEach((element, eventIndex) => {
@@ -819,8 +815,12 @@ export class AgendaPage implements OnInit {
this.showTimelineMD = true;
this.timelineBoxCorrectHeight(500);
this.centralizeTimeline(500);
counter++;
if(counter==2){
this.showLoader = false;
this.timelineBoxCorrectHeight(500);
this.centralizeTimeline(500);
}
});
@@ -837,7 +837,7 @@ export class AgendaPage implements OnInit {
this.eventsList = response;
}
this.eventSource=[];
this.eventSource = this.eventSource.filter(e => e.profile != 'pr');
this.eventsList.forEach((element, eventIndex) => {
@@ -863,10 +863,13 @@ export class AgendaPage implements OnInit {
this.showTimelinePR = true;
this.timelineBoxCorrectHeight(500);
this.centralizeTimeline(500);
counter++;
this.showLoader = false;
if(counter==2){
this.showLoader = false;
this.timelineBoxCorrectHeight(500);
this.centralizeTimeline(500);
}
});