Rename code requirement data funcs

This commit is contained in:
2023-12-20 07:55:33 -06:00
parent 074fc0ee51
commit a915e80d7a

View File

@@ -22,17 +22,17 @@ func RemoveCode(location int64, member_id int) {
db.Del(key) db.Del(key)
} }
// SetCodeRequired sets whether or not a guest code is required for a given location. // SetCodeRequirement sets whether or not a guest code is required for a given location.
// This acts as sort of a 'cache' to avoid testing guest code requirements every time. // This acts as sort of a 'cache' to avoid testing guest code requirements every time.
func SetCodeRequired(location int64, required bool) { func SetCodeRequirement(location int64, required bool) {
key := fmt.Sprintf("code_required:%d", location) key := fmt.Sprintf("code_required:%d", location)
db.Set(key, required, 0) db.Set(key, required, 0)
} }
// GetCodeRequired returns whether or not a guest code is required for a given location. // GetCodeRequirement returns whether or not a guest code is required for a given location.
// This uses the const values defined in types.go: GuestCodeRequired, GuestCodeNotRequired, and Unknown. // This uses the const values defined in types.go: GuestCodeRequired, GuestCodeNotRequired, and Unknown.
// In the case that no tests have been performed, Unknown will be returned. // In the case that no tests have been performed, Unknown will be returned.
func GetCodeRequired(location int64) uint { func GetCodeRequirement(location int64) uint {
key := fmt.Sprintf("code_required:%d", location) key := fmt.Sprintf("code_required:%d", location)
if db.Exists(key).Val() == 0 { if db.Exists(key).Val() == 0 {
return Unknown return Unknown