Skip to content

Commit

Permalink
feat(rup): ejecucion agendas anteriores a hoy
Browse files Browse the repository at this point in the history
  • Loading branch information
Pancho authored and liquid36 committed Jun 12, 2020
1 parent 2739158 commit cfd36df
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 cfd36df

Please sign in to comment.