Esempio n. 1
0
def hypothetical_philanthropist():
    global my_donors
    while True:
        try:
            multiplier = int(
                input("\nWhat factor would the philanthropist "
                      "like to multiply donations by? "))
            break
        except ValueError:
            print("\nThat wasn't a number value.")
    while True:
        try:
            min_donation = int(input("\nWhat is the min donation to match? "))
            break
        except ValueError:
            print("\nThat wasn't a number value.")
    while True:
        try:
            max_donation = int(input("\nWhat is the max donation to match? "))
            break
        except ValueError:
            print("\nThat wasn't a number value.")
    new_list = donor_list_multiplier(my_donors, multiplier, min_donation,
                                     max_donation)
    new_donor_list = Donor_list()
    for new_donor in new_list:
        new_donor_list.add_donor(new_donor)
    original_total_donations = 0
    for donor in my_donors.donor_dictionary:
        original_total_donations += sum(donor.donations)
    total_donations = 0
    for donor in new_donor_list.donor_dictionary:
        total_donations += sum(donor.donations)
    print('\nThe total donations after your gift will be {}. Your share is {}'.
          format(total_donations, total_donations - original_total_donations))
Esempio n. 2
0
def test_add_donation_existing_donor():
    '''test function that adds donations to existing person'''
    alex = Donor('Alex', [100])
    ryan = Donor('Ryan', [300])
    donor_list_obj = Donor_list(alex, ryan)
    run_mailroom.add_donation('Ryan', 500, donor_list_obj)
    assert donor_list_obj.get_donor('Ryan').donations == [300, 500]
Esempio n. 3
0
def philanthropist():
    global my_donors
    while True:
        try:
            multiplier = int(
                input("\nWhat factor would the philanthropist "
                      "like to multiply donations by? "))
            break
        except ValueError:
            print("\nThat wasn't a number value.")
    while True:
        try:
            min_donation = int(input("\nWhat is the min donation to match? "))
            break
        except ValueError:
            print("\nThat wasn't a number value.")
    while True:
        try:
            max_donation = int(input("\nWhat is the max donation to match? "))
            break
        except ValueError:
            print("\nThat wasn't a number value.")
    new_list = donor_list_multiplier(my_donors, multiplier, min_donation,
                                     max_donation)
    new_donor_list = Donor_list()
    for new_donor in new_list:
        new_donor_list.add_donor(new_donor)
    my_donors = new_donor_list
def philanthropist():
    global my_donors
    multip, min_donate, max_donate = get_philan_info()
    new_list = donor_list_multiplier(my_donors, multip, min_donate, max_donate)
    new_donor_list = Donor_list()
    for new_donor in new_list:
        new_donor_list.add_donor(new_donor)
    my_donors = new_donor_list
def hypothetical_philanthropist():
    global my_donors
    multip, min_donate, max_donate = get_philan_info()
    new_list = donor_list_multiplier(my_donors, multip, min_donate, max_donate)
    new_donor_list = Donor_list()
    for new_donor in new_list:
        new_donor_list.add_donor(new_donor)
    orig_total = donor_list_sum(my_donors)
    hypo_total = donor_list_sum(new_donor_list)
    print('\nThe total donations after your gift will be {}. Your share is '
          '{}'.format(hypo_total, hypo_total-orig_total))
Esempio n. 6
0
# Python 220
# Lesson 4
# 7-17-18
# !/usr/bin/env python3

import os
from mailroom import Donor, Donor_list
import json

donor_history = Donor_list(Donor('Brandon Henson', [1005.49, 3116.72, 5200]),
                           Donor('Alicia Henson', [21.47, 1500]),
                           Donor('Michael Green', [2400.54]),
                           Donor('Brandon Henson Jr', [355.42, 579.31]),
                           Donor('Kaiya Henson', [636.9, 850.13, 125.23]))

prompt = ('\nSelect an option:\n'
          '[1] Send A Thank You To New Or Exsisting Donor\n'
          '[2] Create a Report\n'
          '[3] Send letters to everyone\n'
          '[4] Exit\n'
          '[5] Save\n'
          '[6] Load\n')

directory_prompt = ("\nChoose save location or press enter for default")


def menu_selection(prompt, dispatch_dict):
    while True:
        response = input(prompt)
        try:
            if dispatch_dict[response]() == "Exit Menu":
Esempio n. 7
0
#!/usr/bin/env python3

import os
from mailroom import Donor, Donor_list

my_donors = Donor_list(Donor('Ryan Moore', [500, 250]),
                       Donor('Ted Laws', [1000, 100]),
                       Donor('Ben Snell', [150]),
                       Donor('Andrew Crawford', [2000, 2000, 4000]),
                       Donor('Beth Ross', [400]))

prompt = ("\nWhat would you like to do?\n"
          "Choose an action from this list:\n"
          "1 - Add a New Donation to the Records\n"
          "2 - Send a Thank You\n"
          "3 - Thank Everyone\n"
          "4 - Create a Report\n"
          "5 - Manage a Philanthropist donation\n"
          "6 - Build projections for a philanthropist\n"
          "7 - Quit\n")

directory_prompt = ("\nWhere would you like to save the thank you note?"
                    "\n(Leave blank for this directory): ")


def menu_selection(prompt, dispatch_dict):
    while True:
        response = input(prompt)
        try:
            if dispatch_dict[response]() == "Exit Menu":
                break
#!/usr/bin/env python3

import os
from mailroom import Donor, Donor_list
import json

my_donors = Donor_list(Donor('Ted Laws', [1000, 100]),
                       Donor('Kristin Laws', [150]),
                       Donor('Andrew Crawford', [2000, 2000, 4000]),
                       Donor('Beth Ross', [400]))


prompt = ("\nWhat would you like to do?\n"
          "Choose an action from this list:\n"
          "1 - Load Donation Records\n"
          "2 - Save Current Donation Records\n"
          "3 - Add a New Donation to the Records\n"
          "4 - Send a Thank You\n"
          "5 - Thank Everyone\n"
          "6 - Create a Report\n"
          "7 - Manage a Philanthropist donation\n"
          "8 - Build projections for a philanthropist\n"
          "9 - Quit\n")

directory_prompt = ("\nWhere would you like to save the thank you note?"
                    "\n(Leave blank for this directory): ")


def menu_selection(prompt, dispatch_dict):
    while True:
        response = input(prompt)
Esempio n. 9
0
def test_donor_list():
    alex = Donor('Alex', [100])
    a = Donor_list(alex)
    assert a.donor_dictionary == [alex]
Esempio n. 10
0
def test_add_donation_new_donor():
    '''test function that adds donations to new person'''
    alex = Donor('Alex', [100])
    donor_list_obj = Donor_list(alex)
    run_mailroom.add_donation('Ryan', 500, donor_list_obj)
    assert donor_list_obj.get_donor('Ryan').donations == [500]
Esempio n. 11
0
def test_donor_list_str():
    alex = Donor('Alex', [100])
    ryan = Donor('Ryan', [300])
    a = Donor_list(alex, ryan)
    assert a.__str__() == 'Alex\nRyan'
Esempio n. 12
0
def test_donor_list_get():
    alex = Donor('Alex', [100])
    ryan = Donor('Ryan', [300])
    a = Donor_list(alex, ryan)
    b = a.sort_donors()
    assert b == [ryan, alex]
Esempio n. 13
0
def test_donor_list_get():
    alex = Donor('Alex', [100])
    ryan = Donor('Ryan', [300])
    a = Donor_list(alex, ryan)
    alex_donor = a.get_donor(alex.name)
    assert alex_donor == alex
Esempio n. 14
0
def test_check_donor_list():
    alex = Donor('Alex', [100])
    ryan = Donor('Ryan', [300])
    a = Donor_list(alex, ryan)
    is_alex = a.check_donor(alex.name)
    assert is_alex is True
Esempio n. 15
0
def test_donor_list_add_donor():
    alex = Donor('Alex', [100])
    ryan = Donor('Ryan', [300])
    a = Donor_list(alex)
    a.add_donor(ryan)
    assert a.donor_dictionary == [alex, ryan]