File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -35,9 +35,9 @@ const (
35
35
EntitlementNotEntitled Entitlement = "not_entitled"
36
36
)
37
37
38
- // entitlementWeight converts the enum types to a numerical value for easier
38
+ // Weight converts the enum types to a numerical value for easier
39
39
// comparisons. Easier than sets of if statements.
40
- func entitlementWeight (e Entitlement ) int {
40
+ func (e Entitlement ) Weight ( ) int {
41
41
switch e {
42
42
case EntitlementEntitled :
43
43
return 2
@@ -194,7 +194,7 @@ func CompareFeatures(a, b Feature) int {
194
194
// feature can be "greater" than an entitled.
195
195
// If either is "NotEntitled" then we can defer to a strict entitlement
196
196
// check.
197
- if entitlementWeight ( a .Entitlement ) >= 0 && entitlementWeight ( b .Entitlement ) >= 0 {
197
+ if a .Entitlement . Weight ( ) >= 0 && b .Entitlement . Weight ( ) >= 0 {
198
198
if a .Capable () && ! b .Capable () {
199
199
return 1
200
200
}
@@ -205,7 +205,7 @@ func CompareFeatures(a, b Feature) int {
205
205
}
206
206
207
207
// Strict entitlement check. Higher is better
208
- entitlementDifference := entitlementWeight ( a .Entitlement ) - entitlementWeight ( b .Entitlement )
208
+ entitlementDifference := a .Entitlement . Weight ( ) - b .Entitlement . Weight ( )
209
209
if entitlementDifference != 0 {
210
210
return entitlementDifference
211
211
}
You can’t perform that action at this time.
0 commit comments