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