public WorkTime?FindLatestFromSnapshot(User user) { var found = _repository.FindLatestFromSnapshot(user); if (found == null) { return(null); } if (found.AggregateId == _moduleService.CurrentWorkTime?.AggregateId) { return(WorkTime.Combine(found, _moduleService.CurrentWorkTime)); } return(found); }
public WorkTime?Find(User user, DateTime date) { var found = _repository.Find(user, date); if (found == null) { return(null); } if (found.AggregateId == _moduleService.CurrentWorkTime?.AggregateId) { return(WorkTime.Combine(found, _moduleService.CurrentWorkTime)); } return(found); }
public WorkTime?FindFromSnapshot(WorkTimeSnapshotCreated snapshotEvent) { var found = _repository.FindFromSnapshot(snapshotEvent); if (found == null) { return(null); } if (found.AggregateId == _moduleService.CurrentWorkTime?.AggregateId) { return(WorkTime.Combine(found, _moduleService.CurrentWorkTime)); } return(found); }
public List <WorkTime> FindAll(User user, DateTime?startDate, DateTime?endDate) { var found = _repository.FindAll(user, startDate, endDate); if (_moduleService.CurrentWorkTime != null) { for (int i = 0; i < found.Count; i++) { if (found[i].AggregateId == _moduleService.CurrentWorkTime.AggregateId) { found[i] = WorkTime.Combine(found[i], _moduleService.CurrentWorkTime); break; } } } return(found); }
public void Combine_ads_new_events() { var workTime = WorkTimeTestUtils.CreateManual(_user); workTime.StartManually(); var snap = workTime.TakeSnapshot(); var totalEvs = workTime.PendingEvents.Count; var fromSnap = WorkTime.CreateFromSnapshot(snap); fromSnap.AddRecognitionFailure(DateTime.UtcNow, false, false); WorkTime joined = WorkTime.Combine(workTime, fromSnap); joined.PendingEvents.Count.Should().Be(totalEvs + 1); joined.PendingEvents.Last().Should().BeOfType <FaceRecognitionFailure>(); }