report leave sort
Some checks failed
release-dev / release-dev (push) Failing after 12s

This commit is contained in:
kittapath 2025-03-07 23:30:43 +07:00
parent 4487214e95
commit 3b95c4d2d1
2 changed files with 64 additions and 42 deletions

View file

@ -68,40 +68,40 @@ jobs:
docker compose pull docker compose pull
docker compose up -d docker compose up -d
echo "${{ steps.gen_ver.outputs.image_ver }}"> success echo "${{ steps.gen_ver.outputs.image_ver }}"> success
- name: Notify Discord Success # - name: Notify Discord Success
if: success() # if: success()
run: | # run: |
curl -H "Content-Type: application/json" \ # curl -H "Content-Type: application/json" \
-X POST \ # -X POST \
-d '{ # -d '{
"embeds": [{ # "embeds": [{
"title": "✅ Deployment Success!", # "title": "✅ Deployment Success!",
"description": "**Details:**\n- Image: `${{env.IMAGE_NAME}}`\n- Version: `${{ steps.gen_ver.outputs.image_ver }}`\n- Deployed by: `${{github.actor}}`", # "description": "**Details:**\n- Image: `${{env.IMAGE_NAME}}`\n- Version: `${{ steps.gen_ver.outputs.image_ver }}`\n- Deployed by: `${{github.actor}}`",
"color": 3066993, # "color": 3066993,
"footer": { # "footer": {
"text": "Release Notification", # "text": "Release Notification",
"icon_url": "https://example.com/success-icon.png" # "icon_url": "https://example.com/success-icon.png"
}, # },
"timestamp": "'$(date -u +%Y-%m-%dT%H:%M:%SZ)'" # "timestamp": "'$(date -u +%Y-%m-%dT%H:%M:%SZ)'"
}] # }]
}' \ # }' \
${{ secrets.DISCORD_WEBHOOK }} # ${{ secrets.DISCORD_WEBHOOK }}
- name: Notify Discord Failure # - name: Notify Discord Failure
if: failure() # if: failure()
run: | # run: |
curl -H "Content-Type: application/json" \ # curl -H "Content-Type: application/json" \
-X POST \ # -X POST \
-d '{ # -d '{
"embeds": [{ # "embeds": [{
"title": "❌ Deployment Failed!", # "title": "❌ Deployment Failed!",
"description": "**Details:**\n- Image: `${{env.IMAGE_NAME}}`\n- Version: `${{ steps.gen_ver.outputs.image_ver }}`\n- Attempted by: `${{github.actor}}`", # "description": "**Details:**\n- Image: `${{env.IMAGE_NAME}}`\n- Version: `${{ steps.gen_ver.outputs.image_ver }}`\n- Attempted by: `${{github.actor}}`",
"color": 15158332, # "color": 15158332,
"footer": { # "footer": {
"text": "Release Notification", # "text": "Release Notification",
"icon_url": "https://example.com/failure-icon.png" # "icon_url": "https://example.com/failure-icon.png"
}, # },
"timestamp": "'$(date -u +%Y-%m-%dT%H:%M:%SZ)'" # "timestamp": "'$(date -u +%Y-%m-%dT%H:%M:%SZ)'"
}] # }]
}' \ # }' \
${{ secrets.DISCORD_WEBHOOK }} # ${{ secrets.DISCORD_WEBHOOK }}

View file

@ -77,6 +77,22 @@ namespace BMA.EHR.Leave.Service.Controllers
public bool isHoliday { get; set; } public bool isHoliday { get; set; }
} }
private class DateResultReport
{
public int no { get; set; }
public string fullName { get; set; }
public string dutyTimeName { get; set; }
public string checkInLocation { get; set; }
public string checkInTime { get; set; }
public string checkOutLocation { get; set; }
public string checkOutTime { get; set; }
public string remark { get; set; }
public string checkInDate { get; set; }
public string checkedOutDate { get; set; }
public DateTime? checkInTimeRaw { get; set; }
public DateTime? checkOutTimeRaw { get; set; }
}
#endregion #endregion
@ -1159,7 +1175,7 @@ namespace BMA.EHR.Leave.Service.Controllers
var dateList = new List<LoopDate>(); var dateList = new List<LoopDate>();
for (DateTime i = req.StartDate.Date; i <= req.EndDate.Date; i = i.AddDays(1)) for (DateTime i = req.StartDate.Date; i <= req.EndDate.Date; i = i.AddDays(1))
{ {
if (!excludeDates.Contains(i)) if (excludeDates.Contains(i))
{ {
dateList.Add(new LoopDate dateList.Add(new LoopDate
{ {
@ -1172,12 +1188,12 @@ namespace BMA.EHR.Leave.Service.Controllers
dateList.Add(new LoopDate dateList.Add(new LoopDate
{ {
date = i, date = i,
isHoliday = true, isHoliday = false,
}); });
} }
} }
var employees = new List<dynamic>(); var employees = new List<DateResultReport>();
var count = 1; var count = 1;
var restTotal = 0; var restTotal = 0;
@ -1278,7 +1294,7 @@ namespace BMA.EHR.Leave.Service.Controllers
} }
} }
var emp = new var emp = new DateResultReport
{ {
no = count, no = count,
fullName = fullName, fullName = fullName,
@ -1291,12 +1307,13 @@ namespace BMA.EHR.Leave.Service.Controllers
$"{timeStamps.CheckOut.Value.ToString("HH:mm")} น." : $"{timeStamps.CheckOut.Value.ToString("HH:mm")} น." :
"", "",
remark = remarkStr, remark = remarkStr,
date = timeStamps == null ? dd.date.Date : timeStamps.CheckIn.Date,
checkInDate = timeStamps == null ? dd.date.Date.ToThaiFullDate2() : timeStamps.CheckIn.Date.ToThaiFullDate2(), checkInDate = timeStamps == null ? dd.date.Date.ToThaiFullDate2() : timeStamps.CheckIn.Date.ToThaiFullDate2(),
checkedOutDate = timeStamps == null ? dd.date.Date.ToThaiFullDate2() : checkedOutDate = timeStamps == null ? dd.date.Date.ToThaiFullDate2() :
timeStamps.CheckOut != null ? timeStamps.CheckOut != null ?
timeStamps.CheckOut.Value.ToThaiFullDate2() : timeStamps.CheckOut.Value.ToThaiFullDate2() :
"", "",
checkInTimeRaw = timeStamps?.CheckIn,
checkOutTimeRaw = timeStamps?.CheckOut,
}; };
if (timeStamps != null) if (timeStamps != null)
@ -1332,6 +1349,11 @@ namespace BMA.EHR.Leave.Service.Controllers
count++; count++;
} }
} }
employees = employees.OrderBy(x => x.checkInTimeRaw ?? DateTime.MaxValue).ThenBy(x => x.checkOutTimeRaw ?? DateTime.MaxValue).ToList();
for (int i = 0; i < employees.Count; i++)
{
employees[i].no = i + 1;
}
var enddate = req.EndDate.Date == req.StartDate.Date ? "" : $" - {req.EndDate.Date.ToThaiShortDate()}"; var enddate = req.EndDate.Date == req.StartDate.Date ? "" : $" - {req.EndDate.Date.ToThaiShortDate()}";
var item = new var item = new
@ -1346,7 +1368,7 @@ namespace BMA.EHR.Leave.Service.Controllers
wfhTotal = wfhTotal, wfhTotal = wfhTotal,
seminarTotal = seminarTotal, seminarTotal = seminarTotal,
studyTotal = studyTotal, studyTotal = studyTotal,
employees = employees.OrderBy(x => x.date).ToList() employees = employees
}; };
//วันที่ออก //วันที่ออก
var result = new var result = new