Scanning for LeafWeb data submission errors
This commit is contained in:
@@ -211,5 +211,33 @@ namespace LeafWeb.Core.Tests.Parsers
|
||||
}
|
||||
LeafInputCsvParser.ExportCsv(@"C:\Temp\test.csv", leafInputs);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Explicit]
|
||||
[Test]
|
||||
public void FailedParseData_FindIssues()
|
||||
{
|
||||
const string dir = @"C:\temp\LeafWeb_FailedParseData\";
|
||||
|
||||
var files = Directory.GetFiles(dir, "*.csv", SearchOption.AllDirectories).Select(f => new FileInfo(f)).ToList();
|
||||
var leafInputs = new List<LeafInputData>();
|
||||
var num = 1;
|
||||
foreach (var file in files)
|
||||
{
|
||||
try
|
||||
{
|
||||
var parser = new LeafInputCsvParser(file);
|
||||
var leafInput = parser.Parse();
|
||||
leafInputs.Add(leafInput);
|
||||
Console.WriteLine("{3}/{4}, {0}, {1}, {2}", file.Name, leafInput.InvestigatorName, leafInput.ContactInformation, num++, files.Count);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
File.AppendAllLines(@"C:\Temp\errors.txt", new[] { string.Format("{2}\\{1} : {0}", ex.Message, file.Name, file.Directory?.Name) });
|
||||
Console.WriteLine("{2}\\{1} : {0}", ex.Message, file.Name, file.Directory?.Name);
|
||||
}
|
||||
}
|
||||
LeafInputCsvParser.ExportCsv(@"C:\Temp\test.csv", leafInputs);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,6 +63,12 @@ namespace LeafWeb.WebCms.Models
|
||||
|
||||
public bool ShowOnlySuccessfullyCompleted => !string.IsNullOrEmpty(compl);
|
||||
|
||||
[Display(Name = "Show Only Erred")]
|
||||
[UIHint("Checkbox")]
|
||||
public string erred { get; set; }
|
||||
|
||||
public bool ShowOnlyErred => !string.IsNullOrEmpty(erred);
|
||||
|
||||
[Display(Name = "Only my data")]
|
||||
[UIHint("Checkbox")]
|
||||
public string usr { get; set; }
|
||||
@@ -83,6 +89,7 @@ namespace LeafWeb.WebCms.Models
|
||||
&& string.IsNullOrEmpty(tleaf)
|
||||
&& string.IsNullOrEmpty(phips2)
|
||||
&& string.IsNullOrEmpty(compl)
|
||||
&& string.IsNullOrEmpty(erred)
|
||||
);
|
||||
|
||||
public bool HasParameters =>
|
||||
|
||||
@@ -154,6 +154,16 @@ namespace LeafWeb.WebCms.Utility
|
||||
select li;
|
||||
}
|
||||
|
||||
if (query.ShowOnlyErred)
|
||||
{
|
||||
resultItems =
|
||||
from li in resultItems
|
||||
where
|
||||
// has an error message
|
||||
li.OutputFiles.Any(f => f.Filename.Contains(LeafOutputFile.Filename_ErrorMessage))
|
||||
select li;
|
||||
}
|
||||
|
||||
if (query.OnlyUserData && !string.IsNullOrEmpty(currentUserEmail))
|
||||
{
|
||||
resultItems =
|
||||
|
||||
@@ -41,20 +41,6 @@ else
|
||||
new {id="register-member"}))
|
||||
{
|
||||
@Html.ValidationSummary(false)
|
||||
<ul class="d-none">
|
||||
@foreach (var ms in ViewData.ModelState)
|
||||
{
|
||||
<li>@ms.Key
|
||||
<ul>
|
||||
<li>@ms.Value.Value.AttemptedValue</li>
|
||||
@foreach (var valueError in ms.Value.Errors)
|
||||
{
|
||||
<li>@valueError.ErrorMessage</li>
|
||||
}
|
||||
</ul>
|
||||
</li>
|
||||
}
|
||||
</ul>
|
||||
|
||||
@Html.EditorFor(m => registerModel.Name)
|
||||
@Html.EditorFor(m => registerModel.Email, new { type = "email"})
|
||||
@@ -66,7 +52,7 @@ else
|
||||
</div>
|
||||
@Html.HiddenFor(m => registerModel.MemberTypeAlias)
|
||||
@Html.HiddenFor(m => registerModel.RedirectUrl)
|
||||
@Html.HiddenFor(m => registerModel.UsernameIsEmail)
|
||||
@*@Html.HiddenFor(m => registerModel.UsernameIsEmail)*@
|
||||
|
||||
<button type="submit" class="btn btn-primary pull-right">Register</button>
|
||||
}
|
||||
|
||||
@@ -26,7 +26,9 @@
|
||||
new ViewDataDictionary{
|
||||
{"actionName", "Search"},
|
||||
{"controllerName", "Queue"},
|
||||
{"htmlFormAction", "/admin/manage-queue/"}})
|
||||
{"htmlFormAction", "/admin/manage-queue/"},
|
||||
{"admin", true}
|
||||
})
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -7,27 +7,26 @@
|
||||
<div class="row pb-3">
|
||||
|
||||
@ChartLink(Model)
|
||||
|
||||
<div class="dropdown pl-3">
|
||||
<button class="btn btn-outline-secondary dropdown-toggle" id="downloadButton"
|
||||
data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
<span class="fa fa-download"></span> Download
|
||||
</button>
|
||||
@if (string.Equals(Model.Email, username, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
<div class="dropdown-menu" aria-labelledby="downloadButton">
|
||||
<a href="@Url.Action("Input", "Download", new {id = Model.LeafInputId})"
|
||||
class="dropdown-item">
|
||||
Input
|
||||
</a>
|
||||
<a href="@Url.Action("OutputToUser", "Download", new {id = Model.LeafInputId})"
|
||||
class="dropdown-item @if (!Model.HasOutputFiles) {<text> disabled</text>}">
|
||||
Output
|
||||
</a>
|
||||
|
||||
@if (string.Equals(Model.Email, username, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
<div class="dropdown pl-3">
|
||||
<button class="btn btn-outline-secondary dropdown-toggle" id="downloadButton"
|
||||
data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
<span class="fa fa-download"></span> Download
|
||||
</button>
|
||||
<div class="dropdown-menu" aria-labelledby="downloadButton">
|
||||
<a href="@Url.Action("Input", "Download", new {id = Model.LeafInputId})"
|
||||
class="dropdown-item">
|
||||
Input
|
||||
</a>
|
||||
<a href="@Url.Action("OutputToUser", "Download", new {id = Model.LeafInputId})"
|
||||
class="dropdown-item @if (!Model.HasOutputFiles) {<text> disabled</text>}">
|
||||
Output
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
|
||||
}
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="container">
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
@model Boolean?
|
||||
|
||||
@{
|
||||
Layout = "_FieldLayout.cshtml";
|
||||
|
||||
var htmlAttributes = new RouteValueDictionary();
|
||||
if (ViewBag.@class != null)
|
||||
{
|
||||
htmlAttributes.Add("class", ViewBag.@class);
|
||||
}
|
||||
}
|
||||
|
||||
@if (Model.HasValue && Model.Value)
|
||||
{
|
||||
<input id="@ViewData.TemplateInfo.GetFullHtmlFieldId("")" name="@ViewData.TemplateInfo.GetFullHtmlFieldId("")"
|
||||
type="checkbox" checked="checked" />
|
||||
}
|
||||
else
|
||||
{
|
||||
<input id="@ViewData.TemplateInfo.GetFullHtmlFieldId("")" name="@ViewData.TemplateInfo.GetFullHtmlFieldId("")"
|
||||
type="checkbox" />
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
<ul class="d-none">
|
||||
@foreach (var ms in ViewData.ModelState)
|
||||
{
|
||||
<li>@ms.Key
|
||||
<ul>
|
||||
<li>@ms.Value.Value.AttemptedValue</li>
|
||||
@foreach (var valueError in ms.Value.Errors)
|
||||
{
|
||||
<li class="text-danger">Error: @valueError.ErrorMessage</li>
|
||||
<li class="text-danger">Ex: @valueError.Exception.Message</li>
|
||||
}
|
||||
</ul>
|
||||
</li>
|
||||
}
|
||||
</ul>
|
||||
@@ -11,6 +11,7 @@
|
||||
var actionName = string.Empty;
|
||||
var controllerName = string.Empty;
|
||||
var htmlFormAction = string.Empty;
|
||||
var admin = false;
|
||||
|
||||
if (ViewData.ContainsKey("actionName"))
|
||||
{
|
||||
@@ -24,6 +25,10 @@
|
||||
{
|
||||
htmlFormAction = (string)ViewData["htmlFormAction"];
|
||||
}
|
||||
if (ViewData.ContainsKey("admin"))
|
||||
{
|
||||
admin = true;
|
||||
}
|
||||
}
|
||||
@using (Html.BeginUmbracoForm(actionName, controllerName, null, new { action = htmlFormAction, id = "leafdataquery" }))
|
||||
{
|
||||
@@ -101,6 +106,14 @@
|
||||
@Html.EditorFor(m => m.compl)
|
||||
</div>
|
||||
</div>
|
||||
@if (admin)
|
||||
{
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
@Html.EditorFor(m => m.erred)
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1075,9 +1075,9 @@
|
||||
<Content Include="Views\Shared\DisplayTemplates\_Details_ResultsLink.cshtml" />
|
||||
<Content Include="Views\Results\Details.cshtml" />
|
||||
<Content Include="Views\MacroPartials\ResultsDetails.cshtml" />
|
||||
<Content Include="Views\Shared\Boolean.cshtml" />
|
||||
<Content Include="Views\Shared\EditorTemplates\Checkbox.cshtml" />
|
||||
<Content Include="Views\Shared\PermissionDenied.cshtml" />
|
||||
<Content Include="Views\Shared\ModelStateErrors.cshtml" />
|
||||
<None Include="Web.Debug.config">
|
||||
<DependentUpon>Web.config</DependentUpon>
|
||||
</None>
|
||||
|
||||
Reference in New Issue
Block a user