Add remaining fields for query

This commit is contained in:
2020-07-03 10:18:13 -04:00
parent d107cc8e8b
commit 7ad10d6ddc
5 changed files with 118 additions and 19 deletions
+22 -3
View File
@@ -6,6 +6,8 @@ namespace LeafWeb.WebCms.Models
{
public class LeafDataQuery
{
private const string FloatingPointRegex = @"^([-+]?[0-9]*\.[0-9]+|[0-9]+)$";
/// <summary>Query</summary>
[Display(Name = "Search", Description = "General query")]
public string q { get; set; }
@@ -37,11 +39,25 @@ namespace LeafWeb.WebCms.Models
public string lonr { get; set; }
/// <summary>Sample CO2 concentration</summary>
//[ParseInfo(17, units: "umol/mol")]
[Display(Name = "CO2 response curves")]
[RegularExpression(@"^([0-9]*\.[0-9]+|[0-9]+)$", ErrorMessage = "Value is numeric")]
[Display(Name = "CO2 response curves (CO2S)")]
[RegularExpression(FloatingPointRegex, ErrorMessage = "Must be numeric")]
public string co2s { get; set; }
/// <summary> PAR measured by the in-chamber quantum sensor</summary>
[Display(Name = "Light response curves (PARi)")]
[RegularExpression(FloatingPointRegex, ErrorMessage = "Must be numeric")]
public string pari { get; set; }
/// <summary> temperature of leaf thermocouple</summary>
[Display(Name = "Temperature response curves (Tleaf)")]
[RegularExpression(FloatingPointRegex, ErrorMessage = "Must be numeric")]
public string tleaf { get; set; }
/// <summary> DeltaF/Fm, the fraction of absorbed PSII photons that are used in photochemistry</summary>
[Display(Name = "Fluorometry measurements (PhiPS2)")]
[RegularExpression(FloatingPointRegex, ErrorMessage = "Must be numeric")]
public string phips2 { get; set; }
public bool HasExtendedParameters =>
!(
string.IsNullOrEmpty(siteid)
@@ -51,6 +67,9 @@ namespace LeafWeb.WebCms.Models
&& string.IsNullOrEmpty(lon)
&& string.IsNullOrEmpty(lonr)
&& string.IsNullOrEmpty(co2s)
&& string.IsNullOrEmpty(pari)
&& string.IsNullOrEmpty(tleaf)
&& string.IsNullOrEmpty(phips2)
);
}
}
+8 -1
View File
@@ -6,9 +6,16 @@ namespace LeafWeb.WebCms.Models
public class LeafInputDataCurveViewModel
{
/// <summary>Sample CO2 concentration</summary>
//[ParseInfo(17, units: "umol/mol")]
public double? CO2S { get; set; }
/// <summary> PAR measured by the in-chamber quantum sensor</summary>
public double? PARi { get; set; }
/// <summary>temperature of leaf thermocouple</summary>
public double? Tleaf { get; set; }
/// <summary>DeltaF/Fm, the fraction of absorbed PSII photons that are used in photochemistry</summary>
public double? PhiPS2 { get; set; }
public LeafInputDataCurveViewModel() {}
public LeafInputDataCurveViewModel(LeafInputDataCurve leafInputDataCurve)
+53
View File
@@ -73,6 +73,7 @@ namespace LeafWeb.WebCms.Utility
select li;
}
// co2s
if (!string.IsNullOrEmpty(query.co2s))
{
@@ -90,6 +91,58 @@ namespace LeafWeb.WebCms.Utility
select li;
}
// pari
if (!string.IsNullOrEmpty(query.pari))
{
var p = double.Parse(query.pari);
resultItems =
from li in resultItems
where
// maximum range inside LeafInputFiles
li.LeafInputData.Max(lid =>
// range of LeafInputData
lid.Data.Max(d => d.PARi)
- lid.Data.Min(d => d.PARi))
>= p
select li;
}
// tleaf
if (!string.IsNullOrEmpty(query.tleaf))
{
var p = double.Parse(query.tleaf);
resultItems =
from li in resultItems
where
// maximum range inside LeafInputFiles
li.LeafInputData.Max(lid =>
// range of LeafInputData
lid.Data.Max(d => d.Tleaf)
- lid.Data.Min(d => d.Tleaf))
>= p
select li;
}
// phips2
if (!string.IsNullOrEmpty(query.phips2))
{
var p = double.Parse(query.phips2);
resultItems =
from li in resultItems
where
// maximum range inside LeafInputFiles
li.LeafInputData.Max(lid =>
// range of LeafInputData
lid.Data.Max(d => d.PhiPS2)
- lid.Data.Min(d => d.PhiPS2))
>= p
select li;
}
return resultItems;
}
}
+16 -8
View File
@@ -52,31 +52,39 @@
<div class="row">
<div class="col-md-6">
<div class="row">
<div class="col-sm-7">
<div class="col-7">
@Html.EditorFor(m => m.Q.lat, new { size = "small", append = "&deg;" })
</div>
<div class="col-sm-5">
<div class="col-5">
@Html.EditorFor(m => m.Q.latr, new { size = "small", prepend = "&plusmn;", append = "&deg;" })
</div>
</div>
</div>
<div class="col-md-6 border-left">
<div class="row">
<div class="col-sm-7">
<div class="col-7">
@Html.EditorFor(m => m.Q.lon, new { size = "small", append = "&deg;" })
</div>
<div class="col-sm-5">
<div class="col-5">
@Html.EditorFor(m => m.Q.lonr, new { size = "small", prepend = "&plusmn;", append = "&deg;" })
</div>
</div>
</div>
</div>
<hr />
<div class="text-body font-weight-bold pb-3">Curve Variation range minimum</div>
<div class="row">
<div class="col">
<div class="text-body">Curve Variation range minimum</div>
@Html.EditorFor(m => m.Q.co2s, new { size = "small", append = "umol/m" })
<div class="col-md-6">
@Html.EditorFor(m => m.Q.co2s, new { size = "small", append = "umol/m", prepend = ">" })
</div>
<div class="col-md-6">
@Html.EditorFor(m => m.Q.pari, new { size = "small", append = "umol/m2/s", prepend = ">" })
</div>
<div class="col-md-6">
@Html.EditorFor(m => m.Q.tleaf, new { size = "small", append = "oC", prepend = ">" })
</div>
<div class="col-md-6">
@Html.EditorFor(m => m.Q.phips2, new { size = "small", prepend = ">" })
</div>
</div>
</div>
@@ -11,7 +11,7 @@
@RendDistinctValues("Latitude [&deg;]", Model.Select(m => m.Site.Latitude?.ToString()))
@RendDistinctValues("Longitude [&deg;]", Model.Select(m => m.Site.Longitude?.ToString()))
@RendDistinctValues("Elevation [m]", Model.Select(m => m.Site.Elevation?.ToString()))
@RendDistinctValues("CO2S",
@*@RendDistinctValues("CO2S",
Model.Select(m =>
m.SiteName + " (" + m.Id + "): " +
string.Join(", ",
@@ -33,21 +33,33 @@
m.SiteName + " (" + m.Id + "): " +
(m.Data?.Max(d => d.CO2S)
- m.Data?.Min(d => d.CO2S))), "<br />")
@RendValue("CO2S Max Range", Model.Max(m =>
m.Data?.Max(d => d.CO2S)
- m.Data?.Min(d => d.CO2S))?.ToString())
@RendValue("CO2S Min Range", Model.Min(m =>
m.Data?.Max(d => d.CO2S)
- m.Data?.Min(d => d.CO2S))?.ToString())*@
@RendValue("CO2 response curves (CO2S) Max range", Model.Max(m =>
m.Data?.Max(d => d.CO2S)
- m.Data?.Min(d => d.CO2S))?.ToString())
@RendValue("Light response curves (PARi) Max range", Model.Max(m =>
m.Data?.Max(d => d.PARi)
- m.Data?.Min(d => d.PARi))?.ToString())
@RendValue("Temperature response curves (Tleaf) Max Range", Model.Max(m =>
m.Data?.Max(d => d.Tleaf)
- m.Data?.Min(d => d.Tleaf))?.ToString())
@RendValue("Fluorometry measurements (PhiPS2) Max Range", Model.Max(m =>
m.Data?.Max(d => d.PhiPS2)
- m.Data?.Min(d => d.PhiPS2))?.ToString())
@helper RendValue(string label, string value)
{
<div class="row pb-lg-2 pb-sm-1 @if (ViewData.Model == null){<text>d-none</text> }">
<div class="col-sm-3 text-truncate border-right border-bottom pl-4 pl-sm-5">
<div class="row pb-lg-2 pb-sm-1 @if (ViewData.Model == null || string.IsNullOrEmpty(value)){<text>d-none</text> }">
<div class="col-sm-5 text-truncate border-right border-bottom pl-4 pl-sm-5">
@Html.Raw(label)
</div>
<div class="col-sm-9 border-bottom pl-5 pl-sm-2">
<div class="col-sm-7 border-bottom pl-5 pl-sm-2">
@Html.Raw(@value)
</div>
</div>