Skip to content

Commit

Permalink
IFRCGo#46: Added support for Others in aggregate case reports
Browse files Browse the repository at this point in the history
  • Loading branch information
Velcrow81 committed Oct 5, 2017
1 parent a4193d4 commit 76e0537
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
Expand Up @@ -41,6 +41,19 @@ public static CaseReportContent Parse(string text)
FemalesOver5 = numbers[4]
};
}
else if (numbers.Count == 7)
{
return new MultipleCaseReportContent
{
HealthRiskId = numbers[0],
MalesUnder5 = numbers[1],
MalesOver5 = numbers[2],
FemalesUnder5 = numbers[3],
FemalesOver5 = numbers[4],
OthersUnder5 = numbers[5],
OthersOver5 = numbers[6]
};
}

throw new Exception("Text message should contain 3 or 5 numbers");
}
Expand All @@ -65,9 +78,10 @@ public class MultipleCaseReportContent : CaseReportContent
{
public int FemalesUnder5 { get; set; }
public int FemalesOver5 { get; set; }

public int MalesUnder5 { get; set; }
public int MalesOver5 { get; set; }
public int OthersUnder5 { get; set; }
public int OthersOver5 { get; set; }
}

public class SingleCaseReportContent : CaseReportContent
Expand Down
Expand Up @@ -54,7 +54,7 @@ public void Process(TextMessageReceived @event)
Timestamp = @event.Sent
});
}
if (caseReportContent.GetType() == typeof(SingleCaseReportContent))
if (caseReportContent.GetType() == typeof(MultipleCaseReportContent))
{
throw new NotImplementedException();
}
Expand Down

0 comments on commit 76e0537

Please sign in to comment.