Skip to content

Commit

Permalink
Adições de novos testes no experimento
Browse files Browse the repository at this point in the history
  • Loading branch information
lsoaresesilva committed Aug 4, 2022
1 parent c34538a commit 30073cb
Show file tree
Hide file tree
Showing 4 changed files with 817 additions and 118 deletions.
40 changes: 20 additions & 20 deletions src/app/model/analytics/pageTrack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export default class PageTrackRecord extends Document {
return super.getAll(query, orderBy);
}


static getAllByEstudantes(estudantes:Usuario[], merge = true, type="array"):Observable<any>{
return new Observable(observer=>{
let consultas;
Expand All @@ -51,19 +51,19 @@ export default class PageTrackRecord extends Document {
}else{
consultas[estudante.pk()] = PageTrackRecord.getAll(new Query('estudanteId', '==', estudante.pk()));
}

})
}

let arrayDivididoPrimeiraParte = consultas.slice(0, 10)
let arrayDivididoPrimeiraParte = consultas.slice(0, 5)

let arrayDivididoSegundaParte = consultas.slice(10, 20)
let arrayDivididoSegundaParte = consultas.slice(5, 15)

let arrayDivididoTerceiraParte = consultas.slice(20, 30)
let arrayDivididoTerceiraParte = consultas.slice(15, 20)

let arrayDivididoQuartaParte = consultas.slice(30, 40)
let arrayDivididoQuartaParte = consultas.slice(20, 25)

let arrayDivididoQuintaParte = consultas.slice(40)
let arrayDivididoQuintaParte = consultas.slice(25)

forkJoin(arrayDivididoPrimeiraParte).subscribe(pageTracksPrimeiro=>{

Expand Down Expand Up @@ -91,38 +91,38 @@ export default class PageTrackRecord extends Document {
});
});






});

});






});
})



}

toJson(){
return {id:this.id, pagina:this.pagina, estudante:this["estudanteId"], data:Util.firestoreDateToDate(this.data)};
}



static agruparPorSemana(pageTracks:PageTrackRecord[]){
function getWeekNumber(date){
let onejan = new Date(date.getFullYear(),0,1) as any;
let millisecsInDay = 86400000;
return Math.ceil((((date - onejan) /millisecsInDay) + onejan.getDay()+1)/7);


};

let mapaSemanas = new Map<number, Map<string, number>>();
Expand All @@ -138,7 +138,7 @@ export default class PageTrackRecord extends Document {
let totalVisualizacoes = mapaSemana.get(pTrack.pagina);
if(totalVisualizacoes == null){
mapaSemana.set(pTrack.pagina, 0);
}
}

totalVisualizacoes = mapaSemana.get(pTrack.pagina);
mapaSemana.set(pTrack.pagina, totalVisualizacoes+1);
Expand All @@ -152,7 +152,7 @@ export default class PageTrackRecord extends Document {
let track = new PageTrackRecord(pageTrackJson.id, pageTrackJson.pagina, Usuario.fromJson({id:pageTrackJson.estudante}));
/* track.data = Util.firestoreDateToDate(pageTrackJson.data); */
//track.data = new firebase.firestore.Timestamp(pageTrackJson.data.seconds, pageTrackJson.data.nanoseconds);

track.data = new Date(pageTrackJson.data);
return track;
}
Expand Down
Loading

0 comments on commit 30073cb

Please sign in to comment.