Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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