Update govAge calculation to use DateStart instead of DateAppoint in Leave repositories and controller
Some checks failed
Build & Deploy Leave Service / build (push) Failing after 1h5m56s

This commit is contained in:
Suphonchai Phoonsawat 2026-02-04 10:49:13 +07:00
parent 7775ea85c3
commit 09a7208074
3 changed files with 95 additions and 95 deletions

View file

@ -869,7 +869,7 @@ namespace BMA.EHR.Leave.Service.Controllers
return Error(GlobalMessages.DataNotFound, StatusCodes.Status404NotFound);
}
var govAge = (profile?.DateAppoint?.Date ?? DateTime.Now.Date).DiffDay(DateTime.Now.Date);
var govAge = (profile?.DateStart?.Date ?? DateTime.Now.Date).DiffDay(DateTime.Now.Date);
var leaveType = await _leaveTypeRepository.GetByIdAsync(req.Type);
if (leaveType == null)
@ -985,7 +985,7 @@ namespace BMA.EHR.Leave.Service.Controllers
// var profile = await _userProfileRepository.GetProfileByKeycloakIdAsync(userId, AccessToken);
var profile = await _userProfileRepository.GetProfileByKeycloakIdNewAsync(userId, AccessToken);
var govAge = (profile?.DateAppoint?.Date ?? DateTime.Now.Date).DiffDay(DateTime.Now.Date);
var govAge = (profile?.DateStart?.Date ?? DateTime.Now.Date).DiffDay(DateTime.Now.Date);
var thisYear = DateTime.Now.Year;
var message = string.Empty;
@ -1542,7 +1542,7 @@ namespace BMA.EHR.Leave.Service.Controllers
return Error(GlobalMessages.DataNotFound, StatusCodes.Status404NotFound);
}
var govAge = (profile?.DateAppoint?.Date ?? DateTime.Now.Date).DiffDay(DateTime.Now.Date);
var govAge = (profile?.DateStart?.Date ?? DateTime.Now.Date).DiffDay(DateTime.Now.Date);
var userCalendar = await _userCalendarRepository.GetExist(profile.Id);
var category = userCalendar == null ? "NORMAL" : userCalendar.Calendar;