Skip to content
Snippets Groups Projects
Commit 9509fd7c authored by josborg's avatar josborg
Browse files

Filtro por encuesta

parent 8901381c
No related branches found
No related tags found
No related merge requests found
......@@ -13,7 +13,7 @@
<!--<div>
<button class="btn btn-primary mb-2 ml-3" (click)="asignaturaFilter(asignatura)">filtrar</button>
</div>-->
<table class="table table-borderless">
<table class="table table-borderless table-hover">
<thead>
<tr>
<th scope="col">id</th>
......
......@@ -13,19 +13,24 @@
<!--<div>
<button class="btn btn-primary mb-2 ml-3" (click)="asignaturaFilter(asignatura)">filtrar</button>
</div>-->
<table class="table table-borderless">
<table class="table table-borderless table-hover">
<thead>
<tr>
<th scope="col">id</th>
<th scope="col">code</th>
<th scope="col">Name</th>
<th scope="col">Filtrar</th>
</tr>
</thead>
<tbody *ngFor="let encuesta of encuestasFilter; let i = index">
<tr>
<tr (click)="selecionarEncuesta(i)">
<td>{{encuesta.id}}</td>
<td>{{encuesta.code}}</td>
<td>{{encuesta.name}}</td>
<td>
<button class="btn btn-primary w-100 btn-block"
(click)="selecionarEncuesta(i)">Filtrar</button>
</td>
</tr>
<tr class="border-bottom-2">
<td colspan = "3">
......
......@@ -94,6 +94,7 @@ export class PerfilComponent implements OnInit {
resp => {
if (resp.status < 400) { // Si no hay error en la respuesta
this.encuestas = resp.body as Encuesta[]; // Se obtiene la lista de users desde la respuesta
this.encuestasFilter = this.encuestas;
this.encuestas.forEach(encuesta => {
this.getLinks(encuesta.code);
});
......@@ -141,6 +142,8 @@ export class PerfilComponent implements OnInit {
this.nPreguntasContestadas = 0;
this.nPreguntasContestadasAcertadas = 0;
this.aciertosPorEncuesta=[]
this.encuestasFilter.forEach(encuesta => {
var soluciones = this.soluciones.filter(s => s.idEncuesta == encuesta.id);
if(soluciones.length > 0){
......@@ -182,6 +185,7 @@ export class PerfilComponent implements OnInit {
}
});
}
this.users = []
users.forEach(element => {
var user = this.aciertosPorEncuesta.filter(a => a.userId == element.userId);
var nTop1 = user.filter(u => u.ranking == 1).length;
......@@ -253,6 +257,7 @@ export class PerfilComponent implements OnInit {
}
getLinks(code:string){
this.links = []
this.clienteApiRest.getLinksByCode(code).subscribe(
resp => {
console.log(resp.body as Link[])
......@@ -267,6 +272,12 @@ export class PerfilComponent implements OnInit {
)
}
selecionarEncuesta(i:number){
this.encuestasFilter = []
this.encuestasFilter.push(this.encuestas[i])
this.getSolucionesFilter()
}
asignaturaFilter(i:number){
this.encuestasFilter = []
if(i == 0){
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment