Skip to content

Commit

Permalink
refactor: Reduce code to make it easier to read
Browse files Browse the repository at this point in the history
Reduce the condition that checks if the working hour is not available.
  • Loading branch information
MrDave1999 committed Jan 5, 2023
1 parent bda9d25 commit e57780d
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/Features/AvailabilityHours/Availability.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ public static class Availability
/// <param name="unavailableTimeRange">Una instancia con el rango de tiempo no disponible.</param>
/// <returns><c>true</c> sí la nueva franja de horario no está disponible, de lo contrario devuelve <c>false</c>.</returns>
private static bool IsNotAvailable(ref TimeSpan newStartHour, ref TimeSpan newEndHour, UnavailableTimeRangeDto unavailableTimeRange)
=> (unavailableTimeRange.StartHour != newEndHour && unavailableTimeRange.StartHour >= newStartHour && unavailableTimeRange.StartHour <= newEndHour) ||
(unavailableTimeRange.EndHour != newStartHour && unavailableTimeRange.EndHour >= newStartHour && unavailableTimeRange.EndHour <= newEndHour);
=> unavailableTimeRange.StartHour < newEndHour && newStartHour < unavailableTimeRange.EndHour;

/// <summary>
/// Obtiene las horas disponibles para la reserva de una cita médica.
Expand Down

0 comments on commit e57780d

Please sign in to comment.