-
Notifications
You must be signed in to change notification settings - Fork 4
Amalgamate Code for Quarantine Mechanic #175
Description
The code surrounding the quarantine mechanic has become very confusing and all over the place (I think from different people contributing different parts, myself included). For example, the following functions related to quarantining exist in the code currently:
Person:
- is_quarantined(self)
- set_quarantine(self, day)
- get_quarantine_day(self)
- leave_quarantine(self, day)
- check_quarantine(self, day)
Population:
- get_quarantined(self)
- count_quarantined(self)
- update_quarantine(self, day)
- get_new_quarantined(self)
Many of these functions make sense and are required, but some seem redundant and could be relocated/merged to make the code easier to understand. Additionally, this list does not mention functions related to testing, which is closely intertwined with the quarantine functionality. Many of the listed functions also have convoluted ways of setting values they maybe should not have access to. For example, Mark mentioned that the below code should probably be restricted (currently called in #168 in person.set_quarantine)
self.sim_obj.pop.quarantined[self.index] = self.index
I am not sure what the ideal solution is here. Would it be possible to somehow move these functions to another class? Or should we just merge them into a few functions, and make sure the rest of the code is consistent in using them?