Skip to content

Commit

Permalink
Merge pull request #17 from davewalker5/DFL-24-Error-With-No-Flight-P…
Browse files Browse the repository at this point in the history
…roperties

Dfl 24 error with no flight properties
  • Loading branch information
davewalker5 committed Mar 8, 2024
2 parents 4b107f3 + fac436e commit 6d89b5c
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 35 deletions.
4 changes: 2 additions & 2 deletions docker/ui/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM mcr.microsoft.com/dotnet/core/aspnet:latest
COPY droneflightlog.mvc-1.1.3.0 /opt/droneflightlog.mvc-1.1.3.0
WORKDIR /opt/droneflightlog.mvc-1.1.3.0/bin
COPY droneflightlog.mvc-1.1.4.0 /opt/droneflightlog.mvc-1.1.4.0
WORKDIR /opt/droneflightlog.mvc-1.1.4.0/bin
ENTRYPOINT [ "./DroneFlightLog.Mvc" ]
31 changes: 17 additions & 14 deletions src/DroneFlightLog.Mvc/Controllers/FlightDetailsController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,20 +64,23 @@ public async Task<IActionResult> Index(FlightDetailsViewModel model)
model.UpdatePropertiesFromBoundValues();

// Save newly added property values
for (int i = 0; i < model.Properties.Count; i++)
{
FlightPropertyValue value = model.Properties[i];
if (value.IsNewPropertyValue)
{
model.Properties[i] = await AddNewPropertyValueAsync(model.Id, model.Properties[i]);
}
else if (value.Id > 0)
{
model.Properties[i] = await _properties.UpdateFlightPropertyValueAsync(
value.Id,
value.NumberValue,
value.StringValue,
value.DateValue);
if (model.Properties?.Count > 0)
{
for (int i = 0; i < model.Properties.Count; i++)
{
FlightPropertyValue value = model.Properties[i];
if (value.IsNewPropertyValue)
{
model.Properties[i] = await AddNewPropertyValueAsync(model.Id, model.Properties[i]);
}
else if (value.Id > 0)
{
model.Properties[i] = await _properties.UpdateFlightPropertyValueAsync(
value.Id,
value.NumberValue,
value.StringValue,
value.DateValue);
}
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/DroneFlightLog.Mvc/DroneFlightLog.Mvc.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ReleaseVersion>1.1.3.0</ReleaseVersion>
<FileVersion>1.1.3.0</FileVersion>
<ProductVersion>1.1.3.0</ProductVersion>
<ReleaseVersion>1.1.4.0</ReleaseVersion>
<FileVersion>1.1.4.0</FileVersion>
<ProductVersion>1.1.4.0</ProductVersion>
<Configurations>Release;Debug</Configurations>
<IsPackable>false</IsPackable>
</PropertyGroup>
Expand Down
4 changes: 2 additions & 2 deletions src/DroneFlightLog.Mvc/Models/FlightDetailsViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ public void MergeProperties(List<FlightProperty> availableProperties)
}
else
{
Properties = availableProperties.Select(m => new FlightPropertyValue { Property = m }).ToList();
Properties = availableProperties?.Select(m => new FlightPropertyValue { Property = m }).ToList();
}

// Sort the properties by name
Properties = Properties.OrderBy(p => p.Property.Name).ToList();
Properties = Properties?.OrderBy(p => p.Property.Name).ToList();
}

/// <summary>
Expand Down
31 changes: 17 additions & 14 deletions src/DroneFlightLog.Mvc/Views/FlightDetails/Index.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -67,23 +67,26 @@
</p>
<hr />

@for (int i = 0; i < (Model.Properties.Count / Model.PropertiesPerRow) + 1; i++)
@if (Model.Properties != null)
{
<div class="row">
@for (int j = 0; j < Model.PropertiesPerRow; j++)
{
int index = i * Model.PropertiesPerRow + j;
if (index < Model.Properties.Count)
for (int i = 0; i < (Model.Properties.Count / Model.PropertiesPerRow) + 1; i++)
{
<div class="row">
@for (int j = 0; j < Model.PropertiesPerRow; j++)
{
@await Html.PartialAsync("../Shared/FlightPropertyValue", Model.Properties[index]);
int index = i * Model.PropertiesPerRow + j;
if (index < Model.Properties.Count)
{
@await Html.PartialAsync("../Shared/FlightPropertyValue", Model.Properties[index]);
}
else
{
<div class="col"></div>
}
}
else
{
<div class="col"></div>
}
}
</div>
<br />
</div>
<br />
}
}

<hr />
Expand Down

0 comments on commit 6d89b5c

Please sign in to comment.