diff --git a/TestComponents/Test.cs b/TestComponents/Test.cs index 20f931a..bd96f6d 100644 --- a/TestComponents/Test.cs +++ b/TestComponents/Test.cs @@ -115,7 +115,7 @@ public static void runTestSet(string path, string set) double initialN = _testData.Item2; Dictionary testResults = new Dictionary(); - Dictionary nApplied = fertDict(test, allFert); + Dictionary nApplied = fertDict(test, allFert, _config); string weatherStation = allTests["WeatherStation"][testRow].ToString(); @@ -272,7 +272,7 @@ private static int getTestRow(string test, DataFrame allTests) return testRow; } - private static Dictionary fertDict(string test, DataFrame allFert) + private static Dictionary fertDict(string test, DataFrame allFert, Config _config) { Dictionary fert = new Dictionary(); foreach (DataFrameRow row in allFert.Rows) @@ -292,18 +292,22 @@ private static int getTestRow(string test, DataFrame allTests) date = (DateTime)row[1]; } + DateTime last = new DateTime(); if (fert.Keys.Count > 0) { last = fert.Keys.Last(); } - if (date == last) //If alread fertiliser added for that date add it to existing total - { - fert[last] += Double.Parse(row[2].ToString()); - } - else //add it to a new date + if ((date >= _config.StartDate) && (date <= _config.StartDate)) { - fert.Add(date, Double.Parse(row[2].ToString())); + if (date == last) //If alread fertiliser added for that date add it to existing total + { + fert[last] += Double.Parse(row[2].ToString()); + } + else //add it to a new date + { + fert.Add(date, Double.Parse(row[2].ToString())); + } } } }