예제 #1
0
        private LogItemViewModel header(
            GroupId groupId,
            IThreadSafeTimeEntry[] group,
            LogItemVisualizationIntent visualizationIntent)
        {
            var sample = group.First();

            return(new LogItemViewModel(
                       groupId: groupId,
                       representedTimeEntriesIds: group.Select(timeEntry => timeEntry.Id).ToArray(),
                       visualizationIntent: visualizationIntent,
                       isBillable: sample.Billable,
                       description: sample.Description,
                       duration: DurationAndFormatToString.Convert(
                           TimeSpan.FromSeconds(group.Sum(timeEntry => timeEntry.Duration ?? 0)),
                           durationFormat),
                       projectName: sample.Project?.Name,
                       projectColor: sample.Project?.Color,
                       clientName: sample.Project?.Client?.Name,
                       taskName: sample.Task?.Name,
                       hasTags: sample.Tags.Any(),
                       needsSync: group.Any(timeEntry => timeEntry.SyncStatus == SyncStatus.SyncNeeded),
                       canSync: group.All(timeEntry => timeEntry.SyncStatus != SyncStatus.SyncFailed),
                       isInaccessible: sample.IsInaccessible));
        }
        private LogItemViewModel header(
            GroupId groupId,
            IImmutableList <IThreadSafeTimeEntry> group,
            LogItemVisualizationIntent visualizationIntent,
            int indexInLog,
            int dayInLog,
            int daysInThePast)
        {
            var sample = group.First();

            return(new LogItemViewModel(
                       groupId: groupId,
                       representedTimeEntriesIds: group.Select(timeEntry => timeEntry.Id).ToArray(),
                       visualizationIntent: visualizationIntent,
                       isBillable: sample.Billable,
                       isActive: sample.Project?.Active ?? true,
                       description: sample.Description,
                       duration: DurationAndFormatToString.Convert(
                           TimeSpan.FromSeconds(group.Sum(timeEntry => timeEntry.Duration ?? 0)),
                           durationFormat),
                       projectName: sample.Project?.DisplayName(),
                       projectColor: sample.Project?.Color,
                       clientName: sample.Project?.Client?.Name,
                       taskName: sample.Task?.Name,
                       hasTags: sample.Tags.Any(),
                       needsSync: group.Any(timeEntry => timeEntry.SyncStatus == SyncStatus.SyncNeeded),
                       canSync: group.All(timeEntry => timeEntry.SyncStatus != SyncStatus.SyncFailed),
                       isInaccessible: sample.IsInaccessible,
                       indexInLog: indexInLog,
                       dayInLog: dayInLog,
                       daysInThePast: daysInThePast,
                       projectIsPlaceholder: sample.Project?.IsPlaceholder() ?? false,
                       taskIsPlaceholder: sample.Task?.IsPlaceholder() ?? false));
        }