Skip to content

Instantly share code, notes, and snippets.

@IntegerMan
Created September 22, 2019 23:46
Show Gist options
  • Save IntegerMan/8f721edd216f6c341d8ef3ba55086cc3 to your computer and use it in GitHub Desktop.
Save IntegerMan/8f721edd216f6c341d8ef3ba55086cc3 to your computer and use it in GitHub Desktop.
private BehaviorResult<CrewContext> ProcessCrewWorkOnItem(CrewContext context, WorkItem ticket)
{
var result = GetWorkOnItemResult(context, ticket);
result.Switch(
completed =>
{
ticket.Status = WorkItemStatus.ReadyForReview;
AddMessage(context, $"{context.CrewMember.FullName} finishes work on {ticket.Title}");
},
progress =>
{
ticket.ProgressMade++;
AddMessage(context, $"{context.CrewMember.FullName} made steady progress on {ticket.Title}");
},
setback =>
{
if (setback.Severity > Priority.Normal)
{
ticket.ProgressMade -= 3;
AddMessage(context, $"{context.CrewMember.FullName} encountered a major setback on {ticket.Title}");
}
else
{
ticket.ProgressMade -= 1;
AddMessage(context, $"{context.CrewMember.FullName} encountered a setback on {ticket.Title}");
}
}
);
return MatchedResult(context);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment