apply stash

This commit is contained in:
Eduardo Quiros 2021-08-17 22:25:18 -06:00
parent 4cb626aab7
commit 9f23887793
No known key found for this signature in database
GPG Key ID: B77F36C3F12720B4
3 changed files with 12 additions and 21 deletions

View File

@ -75,12 +75,8 @@ export class EncuestaCompleteComponent implements OnInit {
this.cantidadCalificaciones = parseInt(this.encuesta!.calificacion!.toString().split('.')[1]); this.cantidadCalificaciones = parseInt(this.encuesta!.calificacion!.toString().split('.')[1]);
this.sumCalificacion = this.avgCalificacion * this.cantidadCalificaciones; this.sumCalificacion = this.avgCalificacion * this.cantidadCalificaciones;
} }
this.isLocked = this.verifyPassword(); this.verifyPassword();
if (this.isLocked) { this.loadAll();
this.previousState();
} else {
this.loadAll();
}
}); });
for (let pregunta of this.ePreguntas!) { for (let pregunta of this.ePreguntas!) {
if (pregunta.tipo && pregunta.tipo === PreguntaCerradaTipo.SINGLE) { if (pregunta.tipo && pregunta.tipo === PreguntaCerradaTipo.SINGLE) {
@ -89,17 +85,19 @@ export class EncuestaCompleteComponent implements OnInit {
} }
} }
verifyPassword(): boolean { verifyPassword(): void {
if (this.encuesta!.acceso === AccesoEncuesta.PUBLIC) { if (this.encuesta!.acceso === AccesoEncuesta.PUBLIC) {
return false; this.isLocked = false;
} else { } else {
const modalRef = this.modalService.open(EncuestaPasswordDialogComponent, { size: 'lg', backdrop: 'static' }); const modalRef = this.modalService.open(EncuestaPasswordDialogComponent, { size: 'lg', backdrop: 'static' });
modalRef.componentInstance.encuesta = this.encuesta; modalRef.componentInstance.encuesta = this.encuesta;
modalRef.closed.subscribe(reason => { modalRef.closed.subscribe(reason => {
return reason === 'success'; this.isLocked = reason != 'success';
if (this.isLocked) {
this.previousState();
}
}); });
} }
return true;
} }
ngAfterViewChecked(): void { ngAfterViewChecked(): void {
@ -194,7 +192,6 @@ export class EncuestaCompleteComponent implements OnInit {
this.getOpenQuestionAnswers(); this.getOpenQuestionAnswers();
this.registerOpenQuestionAnswers(); this.registerOpenQuestionAnswers();
this.updateEncuestaRating(); this.updateEncuestaRating();
this.previousState(); this.previousState();
} }

View File

@ -1,5 +1,5 @@
<form class="ds-form" [formGroup]="passwordForm" name="deleteForm" (ngSubmit)="submitPassword()"> <form class="ds-form" name="deleteForm">
<div *ngIf="this.isWrong"> <div class="" *ngIf="this.isWrong">
<p>Contraseña incorrecta</p> <p>Contraseña incorrecta</p>
</div> </div>
<div class="modal-body"> <div class="modal-body">
@ -15,13 +15,7 @@
<fa-icon icon="arrow-left"></fa-icon>&nbsp;<span jhiTranslate="entity.action.cancel">Cancel</span> <fa-icon icon="arrow-left"></fa-icon>&nbsp;<span jhiTranslate="entity.action.cancel">Cancel</span>
</button> </button>
<button <button id="jhi-confirm-delete-option" data-cy="submit" type="submit" class="ds-btn ds-btn--primary" (click)="submitPassword()">
id="jhi-confirm-delete-option"
data-cy="submit"
type="submit"
class="ds-btn ds-btn--primary"
[disabled]="passwordForm.get('password')!.invalid"
>
<span jhiTranslate="entity.action.submit">Submit</span> <span jhiTranslate="entity.action.submit">Submit</span>
</button> </button>
</div> </div>

View File

@ -58,7 +58,7 @@
[disabled]="isLoading" [disabled]="isLoading"
data-toggle="modal" data-toggle="modal"
data-target="#crearPregunta" data-target="#crearPregunta"
*ngIf="encuesta!.estado !== 'FINISHED' && (isAutor() || isEscritor())" *ngIf="encuesta!.estado !== 'ACTIVE' && encuesta!.estado !== 'FINISHED' && (isAutor() || isEscritor())"
> >
<fa-icon icon="sync" [icon]="faPlus"></fa-icon>&nbsp;&nbsp;<span>Crear pregunta</span> <fa-icon icon="sync" [icon]="faPlus"></fa-icon>&nbsp;&nbsp;<span>Crear pregunta</span>
</button> </button>