Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(FEAT) Demanda Insatisfecha: pasar funcionalidad a API #3002

Merged
merged 2 commits into from
Jun 18, 2024
Merged

Conversation

JuanIRamirez
Copy link
Contributor

@JuanIRamirez JuanIRamirez commented Apr 24, 2024

Requerimiento

https://proyectos.andes.gob.ar/browse/CIT-268

Funcionalidad desarrollada

  1. El método post de ../routes/listaEspera.ts decide si agregar un nuevo doc a la colección o una nueva demanda a un doc existente.
  2. Desde app se invoca desde ../turnos/listaEspera.Service.ts método save(...)

UserStory llegó a completarse

  • Si
  • No
  • No corresponde

Requiere actualizaciones en la base de datos

  • Si
  • No

Requiere actualizaciones en la API

Requiere actualizaciones en andes-test-integracion

  • Si
  • No

@@ -53,7 +53,7 @@ export class demandaInsatisfechaComponent {

guardar() {
if (this.motivo && this.tipoPrestacion) {
if (this.serviceListaEspera.guardar(this.paciente, this.tipoPrestacion, this.estado, this.profesional, this.organizacion, this.motivo.nombre, this.origen)) {
if (this.listaEsperaService.save(this.paciente, this.tipoPrestacion, this.estado, this.profesional, this.organizacion, this.motivo.nombre, this.origen)) {
Copy link
Contributor

@negro89 negro89 May 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

El problema de hacer esto (entiendo que ya estaba así) es que la respuesta del save es asincrona, es decir, lo que retorna es una promesa y recien a la vuelta de la api se obtiene el valor. Por lo tanto el if en primera instancia siempre va a dar true.
Lo correcto sería eliminar el if y dejar solo el llamado y, a la vuelta del subscribe, segun sea exito o error se muestra el toast correspondiente:

Suggested change
if (this.listaEsperaService.save(this.paciente, this.tipoPrestacion, this.estado, this.profesional, this.organizacion, this.motivo.nombre, this.origen)) {
this.listaEsperaService.save(this.paciente, this.tipoPrestacion, this.estado, this.profesional, this.organizacion, this.motivo.nombre, this.origen).subscribe(respuesta => {
complete: () => {
*** exito ***
},
error: () => {
*** error ***
}
})

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hecho

@negro89 negro89 added the changes requested Se solicitaron cambios label May 6, 2024
@JuanIRamirez JuanIRamirez force-pushed the CIT-268 branch 2 times, most recently from da79787 to 3edb37c Compare May 23, 2024 13:57
@JuanIRamirez JuanIRamirez added changes done and removed changes requested Se solicitaron cambios labels May 23, 2024
@negro89 negro89 self-requested a review June 4, 2024 13:14
@negro89 negro89 merged commit 67dfab7 into master Jun 18, 2024
2 checks passed
@negro89 negro89 deleted the CIT-268 branch June 18, 2024 17:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants