Skip to content

Commit

Permalink
fix(citas): asistencia en turnos de ayer (#917)
Browse files Browse the repository at this point in the history
Co-authored-by: Pancho <martinebucarey@gmail,com>
  • Loading branch information
martinebucarey and Pancho authored Jun 12, 2020
1 parent 2739158 commit d736668
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions modules/turnos/controller/agenda.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,12 @@ import { Types } from 'mongoose';
export function darAsistencia(req, data, tid = null) {
const turno = getTurno(req, data, tid);
turno.asistencia = 'asistio';

if (!turno.horaAsistencia) {
turno.horaAsistencia = new Date();
if (moment(turno.horaInicio).format('YYYY-MM-DD') < moment().startOf('day').format('YYYY-MM-DD')) {
turno.horaAsistencia = turno.horaInicio; // Para el caso donde se inicia una prestacion de un turno con fecha anterior a hoy
} else {
turno.horaAsistencia = new Date();
}
}

turno.updatedAt = new Date();
Expand Down

0 comments on commit d736668

Please sign in to comment.