This commit is contained in:
Adisak 2025-12-22 13:45:11 +07:00
parent 3b58d38eb1
commit fb282915d1

View file

@ -9,6 +9,8 @@ using BMA.EHR.Domain.Shared;
using Microsoft.AspNetCore.Http;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Serilog;
using System.Diagnostics;
namespace BMA.EHR.Application.Repositories.Leaves.TimeAttendants
{
@ -174,15 +176,19 @@ namespace BMA.EHR.Application.Repositories.Leaves.TimeAttendants
else if (role == "PARENT")
{
data = data
.Where(x => x.RootDnaId == Guid.Parse(nodeId!) && x.Child1DnaId != null).ToList();
.Where(x => x.RootDnaId == Guid.Parse(nodeId!) && x.Child1DnaId != null && x.Child1DnaId != Guid.Empty).ToList();
}
else if (role == "NORMAL")
{
data = data.Where(x =>
node == 0 ? x.RootDnaId == Guid.Parse(nodeId!) && x.Child1DnaId == null :
node == 1 ? x.Child1DnaId == Guid.Parse(nodeId!) && x.Child2DnaId == null :
node == 2 ? x.Child2DnaId == Guid.Parse(nodeId!) && x.Child3DnaId == null :
node == 3 ? x.Child3DnaId == Guid.Parse(nodeId!) && x.Child4DnaId == null :
node == 0 ? x.RootDnaId == Guid.Parse(nodeId!) &&
(x.Child1DnaId == Guid.Empty || x.Child1DnaId == null) :
node == 1 ? x.Child1DnaId == Guid.Parse(nodeId!) &&
(x.Child2DnaId == Guid.Empty || x.Child2DnaId == null) :
node == 2 ? x.Child2DnaId == Guid.Parse(nodeId!) &&
(x.Child3DnaId == Guid.Empty || x.Child3DnaId == null) :
node == 3 ? x.Child3DnaId == Guid.Parse(nodeId!) &&
(x.Child4DnaId == Guid.Empty || x.Child4DnaId == null) :
node == 4 ? x.Child4DnaId == Guid.Parse(nodeId!) :
true
).ToList();