circleguard/circlecore

Formalize is_info_loaded in ReplayContainers

Closed this issue · 0 comments

tybug commented

For any ReplayContainer that represents the empty set of replays, calling cg.load_info repeatedly results in multiple api calls:

user = User(12092800, num=2)
cg.load_info(user)
cg.load_info(user)

This is because if self.replays: in load_info is imperfect as an already info loaded, yet empty, ReplayContainer will have an empty replays. This causes get_scores to get called multiple times unnecessarily when cg.load_info is called repeatedly. We need to formalize the concept of self.is_info_loaded in the code instead of relying on the truthiness of an array check.