diff --git a/WebCms/Models/LeafDataQuery.cs b/WebCms/Models/LeafDataQuery.cs index e0044f0..b2da7cc 100644 --- a/WebCms/Models/LeafDataQuery.cs +++ b/WebCms/Models/LeafDataQuery.cs @@ -35,7 +35,13 @@ namespace LeafWeb.WebCms.Models [Display(Name = "Range")] [RegularExpression(@"^([0-9]|[1-8][0-9]|9[0-9]|1[0-7][0-9]|180)$", ErrorMessage = "± longitude degrees")] public string lonr { get; set; } - + + /// Sample CO2 concentration + //[ParseInfo(17, units: "umol/mol")] + [Display(Name = "CO2 response curves")] + [RegularExpression(@"^([0-9]*\.[0-9]+|[0-9]+)$", ErrorMessage = "Value is numeric")] + public string co2s { get; set; } + public bool HasExtendedParameters => !( string.IsNullOrEmpty(siteid) @@ -44,6 +50,7 @@ namespace LeafWeb.WebCms.Models && string.IsNullOrEmpty(latr) && string.IsNullOrEmpty(lon) && string.IsNullOrEmpty(lonr) + && string.IsNullOrEmpty(co2s) ); } } \ No newline at end of file diff --git a/WebCms/Utility/QueryFilter.cs b/WebCms/Utility/QueryFilter.cs index 4dabbf0..fb2599a 100644 --- a/WebCms/Utility/QueryFilter.cs +++ b/WebCms/Utility/QueryFilter.cs @@ -58,7 +58,7 @@ namespace LeafWeb.WebCms.Utility if (!string.IsNullOrEmpty(query.lon)) { - var longitude = Int32.Parse(query.lon); + var longitude = int.Parse(query.lon); var range = 0; if (!string.IsNullOrEmpty(query.lonr)) { @@ -73,6 +73,20 @@ namespace LeafWeb.WebCms.Utility select li; } + if (!string.IsNullOrEmpty(query.co2s)) + { + var co2s = double.Parse(query.co2s); + + resultItems = + from li in resultItems + where co2s >= + li.LeafInputData.Max(lid => + lid.Data.Max(d => d.CO2S) - + lid.Data.Min(d => d.CO2S) + ) + select li; + } + return resultItems; } } diff --git a/WebCms/Views/Queue/Index.cshtml b/WebCms/Views/Queue/Index.cshtml index 0f5f158..67873b1 100644 --- a/WebCms/Views/Queue/Index.cshtml +++ b/WebCms/Views/Queue/Index.cshtml @@ -71,6 +71,14 @@ +
+
+
+
Curve Variation range minimum
+ + @Html.EditorFor(m => m.Q.co2s, new { size = "small", append = "umol/m" }) +
+
} diff --git a/WebCms/Views/Shared/DisplayTemplates/LeafInputDataViewModels.cshtml b/WebCms/Views/Shared/DisplayTemplates/LeafInputDataViewModels.cshtml index 110c1de..32db1f8 100644 --- a/WebCms/Views/Shared/DisplayTemplates/LeafInputDataViewModels.cshtml +++ b/WebCms/Views/Shared/DisplayTemplates/LeafInputDataViewModels.cshtml @@ -2,15 +2,30 @@ @{ //Layout = "~/Views/Shared/DisplayTemplates/_FieldLayout.cshtml"; } +
+
+ Leaf Input Data +
+
+@RendDistinctValues("Site Id", Model.Select(m => m.SiteName)) +@RendDistinctValues("Latitude [°]", Model.Select(m => m.Site.Latitude?.ToString())) +@RendDistinctValues("Longitude [°]", Model.Select(m => m.Site.Longitude?.ToString())) +@RendDistinctValues("Elevation [m]", Model.Select(m => m.Site.Elevation?.ToString())) +@RendDistinctValues("CO2S", + Model.Select(m => + m.SiteName + ": " + + string.Join(", ", + m.Data?.Select(d => d.CO2S?.ToString()) + ) + ) + ) +@RendDistinctValues("CO2S Min", Model.Select(m => m.Data?.Min(d => d.CO2S).ToString())) +@RendDistinctValues("CO2S Average", Model.Select(m => m.Data?.Average(d => d.CO2S).ToString())) +@RendDistinctValues("CO2S Max", Model.Select(m => m.Data?.Max(d => d.CO2S).ToString())) -@Rend("Site Id", Model.Select(m => m.SiteName)) -@Rend("Latitude [°]", Model.Select(m => m.Site.Latitude?.ToString())) -@Rend("Longitude [°]", Model.Select(m => m.Site.Longitude?.ToString())) -@Rend("Elevation [m]", Model.Select(m => m.Site.Elevation?.ToString())) -@helper Rend(string label, IEnumerable values) +@helper RendValue(string label, string value) { - var value = string.Join(", ", values.Distinct());
@Html.Raw(label) @@ -21,13 +36,8 @@
} - -@*@grid.GetHtml(columns: - grid.Columns( - grid.Column("SiteId"), - grid.Column("Latitude"), - grid.Column("Longitude"), - grid.Column("Elevation") - ), - htmlAttributes: new { @class = "table table-sm table-striped table-bordered table-hover" } - )*@ +@helper RendDistinctValues(string label, IEnumerable values) +{ + var value = string.Join(", ", values.Distinct()); + @RendValue(label, value) +} \ No newline at end of file