How to use the eldonationtracker.donor.Donor function in eldonationtracker

To help you get started, we’ve selected a few eldonationtracker examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github djotaku / ELDonationTracker / eldonationtracker / participant.py View on Github external
def _get_top_donor(self):
        """Return Top Donor from server.

        Uses donor drive's sorting to get the top guy or gal.
        """
        top_donor_json = extralife_io.get_json(self.participant_donor_url, True)
        if not top_donor_json:
            print("[bold red] Couldn't access top donor data[/bold red]")
            return self.top_donor
        else:
            return donor.Donor(top_donor_json[0])
github djotaku / ELDonationTracker / eldonationtracker / team.py View on Github external
self.get_participants()
        self.get_top_5_participants()
        self._participant_calculations()
        self.write_text_files(self.participant_calculation_dict)

    def __str__(self):
        team_info = ""
        if self.team_json != 0:
            team_info = f"Team goal is {self.team_info['Team_goal']}."
        if self.team_id:
            return f"A team found at {self.team_url} ."
        else:
            return "Not a valid team - no team_id."


class TeamParticipant(donor.Donor):
    """Participant Attributes.

    Inherits from the donor class, but
    over-rides the json_to_attributes function.

    API variables:

    :param self.name: participant's name or Anonymous
    :param self.amount: the sum of all donations by this participant
    :param self.number_of_donations: number of all donations by this participant
    :param self.image_url: the url of the participant's avatar image (not used)
    """

    def __init__(self, json):
        self.name, self.amount, self.number_of_donations, self.image_url = self.json_to_attributes(json)