Skip to content

Commit

Permalink
Merge pull request #100 from SSchulze1989/develop
Browse files Browse the repository at this point in the history
v 0.8.2
  • Loading branch information
SSchulze1989 authored Aug 17, 2023
2 parents f39a9db + a1511b4 commit c08c8ff
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 12 deletions.
32 changes: 23 additions & 9 deletions src/iRLeagueManager.Web/ViewModels/ResultFilterViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public string ColumnPropertyName
public string Value
{
get => ConvertFromValue(model.FilterValues.FirstOrDefault() ?? string.Empty, ColumnPropertyName);
set => SetP(model.FilterValues.FirstOrDefault() ?? string.Empty, value => model.FilterValues = new[] { ConvertToValue(value, ColumnPropertyName) }.ToList(), value); }
set => SetP(model.FilterValues.FirstOrDefault() ?? string.Empty, value => model.FilterValues = new[] { value }.ToList(), ConvertToValue(value, ColumnPropertyName)); }
public MatchedValueAction Action { get => model.Action; set => SetP(model.Action, value => model.Action = value, value); }

public override void SetModel(ResultFilterModel model)
Expand All @@ -56,15 +56,29 @@ private void UpdateFilterType()
};
}

private static string ConvertFromValue(string filterValue, string? columnProperty) => columnProperty switch
private static string ConvertFromValue(string filterValue, string? columnProperty)
{
nameof(ResultRowModel.CompletedPct) => ((double)Convert.ChangeType(filterValue, typeof(double), CultureInfo.InvariantCulture) * 100).ToString(),
_ => filterValue
};
if (string.IsNullOrWhiteSpace(filterValue))
{
return filterValue;
}
return columnProperty switch
{
nameof(ResultRowModel.CompletedPct) => ((double)Convert.ChangeType(filterValue, typeof(double), CultureInfo.InvariantCulture) * 100).ToString(CultureInfo.InvariantCulture),
_ => filterValue
};
}

private static string ConvertToValue(string value, string? columnProperty) => columnProperty switch
private static string ConvertToValue(string value, string? columnProperty)
{
nameof(ResultRowModel.CompletedPct) => ((double)Convert.ChangeType(value, typeof(double), CultureInfo.InvariantCulture) / 100).ToString(),
_ => value
};
if (string.IsNullOrWhiteSpace(value))
{
return value;
}
return columnProperty switch
{
nameof(ResultRowModel.CompletedPct) => ((double)Convert.ChangeType(value, typeof(double), CultureInfo.InvariantCulture) / 100).ToString(CultureInfo.InvariantCulture),
_ => value
};
}
}
4 changes: 2 additions & 2 deletions src/iRLeagueManager.Web/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
}
},
"AllowedHosts": "*",
"APIServer": "http://localhost:5000",
//"APIServer": "https://irleaguemanager.net/api/",
//"APIServer": "http://localhost:5000",
"APIServer": "https://irleaguemanager.net/api/",
"DefaultUser": "testuser",
"DefaultPassword": "TestPass123!"
}
2 changes: 1 addition & 1 deletion src/iRLeagueManager.Web/iRLeagueManager.Web.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<Version>0.8.1</Version>
<Version>0.8.2</Version>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<UserSecretsId>aspnet-iRLeagueManager.Web-2B05F9DC-55A3-49D1-BD64-31507000EDF3</UserSecretsId>
Expand Down

0 comments on commit c08c8ff

Please sign in to comment.