def test_get_minimum_created_time_of_active_bills(self): self.assertEqual(self.bill.created_at, BillPrototype.get_minimum_created_time_of_active_bills()) self.bill.remove(initiator=self.account1) # not there are no anothe bills an get_minimum_created_time_of_active_bills return now() self.assertTrue(self.bill.created_at < BillPrototype.get_minimum_created_time_of_active_bills())
def remove_out_game_persons(self): from the_tale.game.bills.prototypes import BillPrototype from the_tale.game.heroes.prototypes import HeroPrototype remove_time_border = min(BillPrototype.get_minimum_created_time_of_active_bills(), HeroPrototype.get_minimum_created_time_of_active_quests()) changed = False for person in self.all(): if person.state == relations.PERSON_STATE.OUT_GAME and person.out_game_at < remove_time_border: person.remove_from_game() person.save() changed = True if changed: self.update_version()
def remove_out_game_persons(self): from the_tale.game.bills.prototypes import BillPrototype from the_tale.game.heroes.prototypes import HeroPrototype remove_time_border = min( BillPrototype.get_minimum_created_time_of_active_bills(), HeroPrototype.get_minimum_created_time_of_active_quests()) changed = False for person in self.all(): if person.state == relations.PERSON_STATE.OUT_GAME and person.out_game_at < remove_time_border: person.remove_from_game() person.save() changed = True if changed: self.update_version()