def run(self): with data_session_scope() as session: for reward in MiningReward.mined_last_24h(session): self.parent().last_24_h_mine_count[ reward.address] = reward.count for reward in MiningReward.last_mined(session): self.parent().last_mined[reward.address] = reward.last_mined for vote in Vote.voted_last_24h(session): self.parent().last_24_h_vote_count[ vote.from_address] = vote.count for vote in Vote.last_voted(session): self.parent().last_voted[vote.from_address] = vote.last_voted for pending_vote in PendingVote.num_revokes( session, self.parent()._perm_type): self.parent().count_revokes[ pending_vote.address_to] = pending_vote.count self.parent().num_guardians = Permission.num_guardians(session) if self.parent()._perm_type == enums.MINE: self.parent()._data = list(Permission.validators(session)) elif self.parent()._perm_type == enums.ADMIN: self.parent()._data = list(Permission.guardians(session)) self.parent()._alias_list = Alias.get_aliases(session) self.parent().already_revoked = PendingVote.already_revoked( session, self.parent()._perm_type)
def load_data(self): if self._perm_type == Permission.MINE: return list(Permission.validators()) elif self._perm_type == Permission.ADMIN: return list(Permission.guardians())