Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
  • 2 commits
  • 3 files changed
  • 0 commit comments
  • 1 contributor
View
8 Source/Gtd.Console/Commands/ChangeProjectTypeCommand.cs
@@ -2,9 +2,9 @@ namespace Gtd.Shell.Commands
{
public sealed class ChangeProjectTypeCommand : IConsoleCommand
{
- public string[] Key { get { return new string[] { "type", "cp"};} }
- public string Usage { get { return @"type <projectId> seq | si | par
- Change project type"; } }
+ public string[] Key { get { return new[] { "type", "pt", "ct"};} }
+ public string Usage { get { return @"type <projectId> seq | li | par
+ Change project type to Sequential | List | Parallel"; } }
public void Execute(ConsoleEnvironment env, string[] args)
{
if (args.Length != 2)
@@ -24,7 +24,7 @@ public void Execute(ConsoleEnvironment env, string[] args)
{
changeTo = ProjectType.Sequential;
}
- else if (lowerInvariant.StartsWith("si"))
+ else if (lowerInvariant.StartsWith("li"))
{
changeTo = ProjectType.List;
}
View
7 Source/Gtd.Console/Filters/AvailableFilter.cs
@@ -29,9 +29,10 @@ public IEnumerable<ActionView> FilterActions(ProjectView view)
}
else
{
- var filtered = view.Actions
- .Where(v => !v.Completed)
- .Where(v => !v.Archived)
+ var availableActions = view.Actions
+ .Where(v => !v.Completed)
+ .Where(v => !v.Archived);
+ var filtered = availableActions
.Where(v => v.StartDate <= DateTime.Now);
foreach (var action in filtered)
View
56 Source/Gtd.Console/Filters/NextActionFilter.cs
@@ -7,16 +7,60 @@ namespace Gtd.Shell.Filters
{
public sealed class NextActionFilter : IFilterCriteria
{
- readonly AvailableFilter _filter = new AvailableFilter();
+
public IEnumerable<ActionView> FilterActions(ProjectView view)
{
- var value = _filter.FilterActions(view).FirstOrDefault();
- if (value != null)
- yield return value;
+ if (view.Type == ProjectType.List)
+ {
+ // in list, every available action is next
+ foreach (var actionView in GetAllAvailableActions(view))
+ {
+ yield return actionView;
+ }
+ }
+ else if (view.Type == ProjectType.Parallel)
+ {
+ // in parallel, first available action is next
+ var filtered = GetAllAvailableActions(view).FirstOrDefault();
+
+ if (filtered != null)
+ {
+ yield return filtered;
+ }
+ }
+ else
+ {
+ // in sequential, first available action is next (unless it's blocked)
+ var filtered = view.Actions
+ .Where(v => !v.Completed)
+ .Where(v => !v.Archived)
+ .FirstOrDefault();
+
+ if (filtered != null && filtered.StartDate <= DateTime.UtcNow)
+ yield return filtered;
+
+ }
+
+ }
+
+ static IEnumerable<ActionView> GetAllAvailableActions(ProjectView view)
+ {
+ return view.Actions
+ .Where(v => !v.Completed)
+ .Where(v => !v.Archived)
+ .Where(v => v.StartDate <= DateTime.Now);
+ }
+
+ public string Title
+ {
+ get { return "Next"; }
+ }
+
+ public string Description
+ {
+ get { return "next thing to do in each eligible project"; }
}
- public string Title { get { return "Next"; } }
- public string Description { get { return "next thing to do in each eligible project"; } }
public string FormatActionCount(int actionCount)
{
switch (actionCount)

No commit comments for this range

Something went wrong with that request. Please try again.