From 9904243b0fc6b5d108aab2417a248ac131e0af65 Mon Sep 17 00:00:00 2001 From: Simon Schulze Date: Thu, 20 Jul 2023 20:04:04 +0200 Subject: [PATCH 1/5] Add filter condition model --- src/iRLeagueApiCore.Common/Enums/ComparatorType.cs | 3 ++- .../ResultConfigurations/FilterConditionModel.cs | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 src/iRLeagueApiCore.Common/Models/ResultConfigurations/FilterConditionModel.cs diff --git a/src/iRLeagueApiCore.Common/Enums/ComparatorType.cs b/src/iRLeagueApiCore.Common/Enums/ComparatorType.cs index 57c4e9f..c9d5965 100644 --- a/src/iRLeagueApiCore.Common/Enums/ComparatorType.cs +++ b/src/iRLeagueApiCore.Common/Enums/ComparatorType.cs @@ -8,5 +8,6 @@ public enum ComparatorType IsBiggerOrEqual, IsBigger, NotEqual, - InList + InList, + ForEach, // special comparator that multiplies the configured bonus/penalty for each multiple of the provided value } diff --git a/src/iRLeagueApiCore.Common/Models/ResultConfigurations/FilterConditionModel.cs b/src/iRLeagueApiCore.Common/Models/ResultConfigurations/FilterConditionModel.cs new file mode 100644 index 0000000..de6e59a --- /dev/null +++ b/src/iRLeagueApiCore.Common/Models/ResultConfigurations/FilterConditionModel.cs @@ -0,0 +1,14 @@ +namespace iRLeagueApiCore.Common.Models.ResultConfigurations; + +[DataContract] +public sealed class FilterConditionModel +{ + [DataMember] + public FilterType FilterType { get; set; } + [DataMember] + public string ColumnPropertyName { get; set; } = string.Empty; + [DataMember] + public ComparatorType Comparator { get; set; } + [DataMember] + public ICollection FilterValues { get; set; } = new List(); +} From 70df8b5aa3b731a224279f188603902fd40c97fb Mon Sep 17 00:00:00 2001 From: Simon Schulze Date: Thu, 20 Jul 2023 20:04:17 +0200 Subject: [PATCH 2/5] Add penalty model using filter conditions --- .../AutoPenaltyConfiguration.cs | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 src/iRLeagueApiCore.Common/Models/ResultConfigurations/AutoPenaltyConfiguration.cs diff --git a/src/iRLeagueApiCore.Common/Models/ResultConfigurations/AutoPenaltyConfiguration.cs b/src/iRLeagueApiCore.Common/Models/ResultConfigurations/AutoPenaltyConfiguration.cs new file mode 100644 index 0000000..5511e0b --- /dev/null +++ b/src/iRLeagueApiCore.Common/Models/ResultConfigurations/AutoPenaltyConfiguration.cs @@ -0,0 +1,22 @@ +namespace iRLeagueApiCore.Common.Models; + +[DataContract] +public sealed class AutoPenaltyConfiguration +{ + [DataMember] + public long LeagueId { get; set; } + [DataMember] + public long PenaltyConfigId { get; set; } + [DataMember] + public string Description { get; set; } = string.Empty; + [DataMember] + public PenaltyType Type { get; set; } + [DataMember(EmitDefaultValue = false)] + public int Points { get; set; } + [DataMember(EmitDefaultValue = false)] + public TimeSpan Time { get; set; } + [DataMember(EmitDefaultValue = false)] + public int Positions { get; set; } + [DataMember] + public ICollection Conditions { get; set; } = new List(); +} From 01d0f9e357fe84fb708785c0cc21bbf8f7e5c60c Mon Sep 17 00:00:00 2001 From: Simon Schulze Date: Fri, 21 Jul 2023 12:23:40 +0200 Subject: [PATCH 3/5] Attach auto penalties to point rule instead of result config --- .../Models/ResultConfigurations/AutoPenaltyConfiguration.cs | 2 +- .../Models/ResultConfigurations/FilterConditionModel.cs | 2 +- .../Models/ResultConfigurations/PostPointRuleModel.cs | 5 +++++ src/iRLeagueApiCore.Common/iRLeagueApiCore.Common.csproj | 2 +- 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/iRLeagueApiCore.Common/Models/ResultConfigurations/AutoPenaltyConfiguration.cs b/src/iRLeagueApiCore.Common/Models/ResultConfigurations/AutoPenaltyConfiguration.cs index 5511e0b..2deb16e 100644 --- a/src/iRLeagueApiCore.Common/Models/ResultConfigurations/AutoPenaltyConfiguration.cs +++ b/src/iRLeagueApiCore.Common/Models/ResultConfigurations/AutoPenaltyConfiguration.cs @@ -18,5 +18,5 @@ public sealed class AutoPenaltyConfiguration [DataMember(EmitDefaultValue = false)] public int Positions { get; set; } [DataMember] - public ICollection Conditions { get; set; } = new List(); + public ICollection Conditions { get; set; } = new List(); } diff --git a/src/iRLeagueApiCore.Common/Models/ResultConfigurations/FilterConditionModel.cs b/src/iRLeagueApiCore.Common/Models/ResultConfigurations/FilterConditionModel.cs index de6e59a..de694e5 100644 --- a/src/iRLeagueApiCore.Common/Models/ResultConfigurations/FilterConditionModel.cs +++ b/src/iRLeagueApiCore.Common/Models/ResultConfigurations/FilterConditionModel.cs @@ -1,4 +1,4 @@ -namespace iRLeagueApiCore.Common.Models.ResultConfigurations; +namespace iRLeagueApiCore.Common.Models; [DataContract] public sealed class FilterConditionModel diff --git a/src/iRLeagueApiCore.Common/Models/ResultConfigurations/PostPointRuleModel.cs b/src/iRLeagueApiCore.Common/Models/ResultConfigurations/PostPointRuleModel.cs index d0f5af1..70f6517 100644 --- a/src/iRLeagueApiCore.Common/Models/ResultConfigurations/PostPointRuleModel.cs +++ b/src/iRLeagueApiCore.Common/Models/ResultConfigurations/PostPointRuleModel.cs @@ -14,4 +14,9 @@ public class PostPointRuleModel public int PointDropOff { get; set; } public ICollection PointsSortOptions { get; set; } = new List(); public ICollection FinalSortOptions { get; set; } = new List(); + /// + /// List of configurations for automated penalties + /// + [DataMember] + public ICollection AutoPenalties { get; set; } = new List(); } diff --git a/src/iRLeagueApiCore.Common/iRLeagueApiCore.Common.csproj b/src/iRLeagueApiCore.Common/iRLeagueApiCore.Common.csproj index 6eedcee..83b5545 100644 --- a/src/iRLeagueApiCore.Common/iRLeagueApiCore.Common.csproj +++ b/src/iRLeagueApiCore.Common/iRLeagueApiCore.Common.csproj @@ -18,7 +18,7 @@ Library net6.0 iRLeagueApiCore.Common - 0.7.1 + 0.7.2-dev.2 Simon Schulze Simon Schulze enable From 774decb98abcd7a8422970b14c61911ab991cc9f Mon Sep 17 00:00:00 2001 From: Simon Schulze Date: Fri, 21 Jul 2023 17:24:15 +0200 Subject: [PATCH 4/5] Add missing "Action" property for filter condition model --- .../Models/ResultConfigurations/FilterConditionModel.cs | 2 ++ src/iRLeagueApiCore.Common/iRLeagueApiCore.Common.csproj | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/iRLeagueApiCore.Common/Models/ResultConfigurations/FilterConditionModel.cs b/src/iRLeagueApiCore.Common/Models/ResultConfigurations/FilterConditionModel.cs index de694e5..ea7cb20 100644 --- a/src/iRLeagueApiCore.Common/Models/ResultConfigurations/FilterConditionModel.cs +++ b/src/iRLeagueApiCore.Common/Models/ResultConfigurations/FilterConditionModel.cs @@ -11,4 +11,6 @@ public sealed class FilterConditionModel public ComparatorType Comparator { get; set; } [DataMember] public ICollection FilterValues { get; set; } = new List(); + [DataMember] + public MatchedValueAction Action { get; set; } } diff --git a/src/iRLeagueApiCore.Common/iRLeagueApiCore.Common.csproj b/src/iRLeagueApiCore.Common/iRLeagueApiCore.Common.csproj index 83b5545..0eb68d9 100644 --- a/src/iRLeagueApiCore.Common/iRLeagueApiCore.Common.csproj +++ b/src/iRLeagueApiCore.Common/iRLeagueApiCore.Common.csproj @@ -18,7 +18,7 @@ Library net6.0 iRLeagueApiCore.Common - 0.7.2-dev.2 + 0.7.2-dev.3 Simon Schulze Simon Schulze enable From 0198b933678b214221e3bb8a73faf949b943940d Mon Sep 17 00:00:00 2001 From: Simon Schulze Date: Sun, 23 Jul 2023 12:46:25 +0200 Subject: [PATCH 5/5] bump version to 0.7.2 --- src/iRLeagueApiCore.Common/iRLeagueApiCore.Common.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/iRLeagueApiCore.Common/iRLeagueApiCore.Common.csproj b/src/iRLeagueApiCore.Common/iRLeagueApiCore.Common.csproj index 0eb68d9..8fddde1 100644 --- a/src/iRLeagueApiCore.Common/iRLeagueApiCore.Common.csproj +++ b/src/iRLeagueApiCore.Common/iRLeagueApiCore.Common.csproj @@ -18,7 +18,7 @@ Library net6.0 iRLeagueApiCore.Common - 0.7.2-dev.3 + 0.7.2 Simon Schulze Simon Schulze enable