mirror of
https://github.com/Sea-Haven-Industries/shoc-backend.git
synced 2026-09-30 22:23:12 +00:00
Calculate lastUpdated from comments, audit log, and modification time
- Takes the max of: LastModificationTime, latest comment CreatedDate, latest audit log CreatedAt - Reflects any comment (customer/vendor/internal) or status change
This commit is contained in:
parent
0a564499f5
commit
091390fcad
1 changed files with 5 additions and 1 deletions
|
|
@ -411,7 +411,11 @@ namespace Api.SeaHavenIndustries.Controllers
|
|||
dueDate = w.DueDate,
|
||||
assignedTo = w.AssignToUser != null ? w.AssignToUser.FirstName + " " + w.AssignToUser.LastName : "",
|
||||
employeeName = w.AssignToUser != null ? w.AssignToUser.FirstName + " " + w.AssignToUser.LastName : "",
|
||||
lastUpdated = w.LastModificationTime
|
||||
lastUpdated = new[] {
|
||||
w.LastModificationTime,
|
||||
w.Comments.Max(c => (DateTime?)c.CreatedDate),
|
||||
_db.WorkOrderAuditLogs.Where(a => a.WorkOrderId == w.Id).Max(a => (DateTime?)a.CreatedAt)
|
||||
}.Where(d => d.HasValue).Max()
|
||||
})
|
||||
.ToList();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue