static IEnumerable<ImmutableAction> GetAllAvailableActions(ImmutableProject model) { return model.Actions .Where(v => !v.Completed) .Where(v => !v.Archived) .Where(v => v.StartDate <= DateTime.Now); }
public IEnumerable<ImmutableAction> FilterActions(ImmutableProject model) { if (model.Info.Type == ProjectType.List) { // in list, every available action is next foreach (var actionView in GetAllAvailableActions(model)) { yield return actionView; } } else if (model.Info.Type == ProjectType.Parallel) { // in parallel, first available action is next var filtered = GetAllAvailableActions(model).FirstOrDefault(); if (filtered != null) { yield return filtered; } } else { // in sequential, first available action is next (unless it's blocked) var filtered = model.Actions .Where(v => !v.Completed) .Where(v => !v.Archived) .FirstOrDefault(); if (filtered != null && filtered.StartDate <= DateTime.UtcNow) yield return filtered; } }
public IEnumerable<ImmutableAction> FilterActions(ImmutableProject model) { if (model.Info.Type == ProjectType.Sequential) { var filtered = model.Actions .Where(v => !v.Completed) .FirstOrDefault(v => !v.Archived); if (filtered != null && filtered.StartDate <= DateTime.UtcNow) yield return filtered; } else { var availableActions = model.Actions .Where(v => !v.Completed) .Where(v => !v.Archived); var filtered = availableActions .Where(v => v.StartDate <= DateTime.Now); foreach (var action in filtered) { yield return action; } } }
public IEnumerable<ImmutableAction> FilterActions(ImmutableProject model) { foreach (var action in model.Actions) { if (action.Archived) continue; if (action.Completed) continue; yield return action; } }
public IEnumerable<ImmutableAction> FilterActions(ImmutableProject model) { return model.Actions; }