def produce_email(board):
    date_label = trello_utility.get_label('Date', board)
    goal_label = trello_utility.get_label('Goal', board)
    event_label = trello_utility.get_label('Event', board)
    report = WeeklyUpdate()

    this_week = trello_utility.get_list('This Week', board)
    for card in this_week.list_cards():
        if card.labels and event_label in card.labels:
            report.add_event_card(card)
        else:
            report.add_week_card(card)

    blocked = trello_utility.get_list('Help Needed!', board)
    for card in blocked.list_cards():
        report.add_blocked_card(card)

    on_going = trello_utility.get_list('On Going', board)
    for card in on_going.list_cards():
        report.add_on_going_card(card)

    done = trello_utility.get_list('Done', board)
    print(done)
    for card in done.list_cards():
        report.add_completed_card(card)

    backlog = trello_utility.get_list('Backlog', board)
    for card in backlog.list_cards():
        if card.labels and event_label in card.labels:
            report.add_event_card(card)

    return report
Exemplo n.º 2
0
def create_dates(board, start_date, end_date, frequency):
    date = start_date
    backlog = trello_utility.get_list('Backlog', board)
    date_label = trello_utility.get_label('Date', board)
    while date < end_date:
        create_date(board, date)
        date += datetime.timedelta(days=frequency)
def year_round_doorknocking(board):
    backlog = trello_utility.get_list("Backlog", board)
    goal_name = 'Complete Initial Door Knock'
    goal_card = backlog.add_card(goal_name)
    door_knocking_description = 'By the start of February, every door on the marked register should be knocked. The ' \
                                'aim ' \
                                'is to have spoken to approximately 50% of those people by this point.\n' \
                                '\n' \
                                'The door knocking should be a mixture of 60 second surveys, petitions and case work ' \
                                'gathering. '

    goal_card.set_description(door_knocking_description)
    goal_card.add_label(trello_utility.get_label('Goal', board))

    goal_label = trello_utility.create_label(goal_name, 'pink', board)
    goal_card.add_label(goal_label)
    goal_card.set_due(datetime.date(day=1, month=2, year=2020))

    final_review_date = datetime.date(day=30, month=11, year=2019)
    final_review_description = 'By this point 75% of the initial door knock should be complete. (Either one or two ' \
                               'complete runs through the marked register)\n' \
                               '\n' \
                               'If this is not the case, discuss with Annie to decide how best to proceed. '

    inital_review_date = datetime.date(day=30, month=9, year=2019)
    initial_review_description = 'By this point canvassing of the marked register be well under way. At this point we ' \
                                 'should be able to estimate:\n' \
                                 '\n' \
                                 ' - how much time at the current rate it will take to get to every door at least once ' \
                                 'by February\n' \
                                 '- whether a second full canvass is required (based on trying to hit 50% spoken to ' \
                                 'by Feb)'

    start_canvassing = datetime.date(day=1, month=9, year=2019)

    prereqs = [
        Prereq(
            'Begin year round canvassing', start_canvassing,
            start_canvassing - datetime.timedelta(days=7), [],
            'Get a group going for a hour or two every week knocking the marked register and enter the data '
        ),
        Prereq('Review canvassing process', inital_review_date,
               inital_review_date - datetime.timedelta(days=7), [],
               initial_review_description),
        Prereq('Verify canvassing progress', final_review_date,
               final_review_date, [], final_review_description)
    ]

    ward_newsletter.add_prereqs(goal_card, prereqs, board, goal_label, backlog)
    goal_card.set_pos(
        datetime.datetime.combine(goal_card.due_date.date(),
                                  datetime.time(12, 0)).timestamp())
Exemplo n.º 4
0
def create_date(board: trello.Board, date: datetime.date, custom_name=None):
    backlog = trello_utility.get_list('Backlog', board)
    date_label = trello_utility.get_label('Date', board)
    if not custom_name:
        custom_name = str(date)

    new_card = backlog.add_card(custom_name)
    try:
        new_card.add_label(date_label)
        new_card.set_due(date)
        new_card.set_pos(date_pos(date))
    except:
        new_card.delete()
Exemplo n.º 5
0
def create_action_day(action_day, board, ward):
    event_name = action_day_name(action_day, ward)
    backlog = trello_utility.get_list("Backlog", board)
    goal_card = backlog.add_card(event_name)
    goal_card.add_label(trello_utility.get_label('Goal', board))

    goal_label = trello_utility.create_label(event_name, "null", board)
    goal_card.add_label(goal_label)
    goal_card.add_label(trello_utility.get_label('Event', board))
    goal_card.set_due(action_day)
    goal_card.set_pos(action_day.timestamp())

    prereqs = [action_day_dependencies(action_day)]
    ward_newsletter.add_prereqs(goal_card, prereqs, board, goal_label, backlog)
Exemplo n.º 6
0
def create_student_leaflet(delivery_date, board, prefix, custom_name=None):
    if not custom_name:
        custom_name = ward_newsletter_name(delivery_date, prefix)
    backlog = trello_utility.get_list("Backlog", board)
    goal_card = backlog.add_card(custom_name)
    goal_card.add_label(trello_utility.get_label('Goal', board))

    goal_label = trello_utility.create_label(
        custom_name, trello_utility.random_goal_colour(), board)
    goal_card.add_label(goal_label)
    goal_card.set_due(delivery_date)

    prereqs = [student_leaflet_dependecies(delivery_date)]
    add_prereqs(goal_card, prereqs, board, goal_label, backlog)
    position_card(board, goal_card)
Exemplo n.º 7
0
def create_targetted_letter(delivery_date: datetime.date, board, prefix, description=''):
    letter_name = target_letter_newsletter_name(delivery_date, prefix)
    backlog = trello_utility.get_list("Backlog", board)
    goal_card = backlog.add_card(letter_name)
    goal_card.add_label(trello_utility.get_label('Goal', board))

    goal_label = trello_utility.create_label(letter_name, trello_utility.random_goal_colour(), board)
    goal_card.add_label(goal_label)
    goal_card.set_due(delivery_date)
    goal_card.set_pos(card_pos(delivery_date))
    goal_card.set_description(description)

    prereqs = [target_letter_dependencies(delivery_date)]
    ward_newsletter.add_prereqs(goal_card, prereqs, board, goal_label, backlog)

    return goal_card
Exemplo n.º 8
0
def create_custom_card(board: trello.Board,
                       name,
                       due_date,
                       start_date=None,
                       description=None):
    backlog = trello_utility.get_list('Backlog', board)
    if start_date:
        start_work_str = 'Start work: ' + str(start_date)
        if description:
            description = start_work_str + '\n\n' + description
        else:
            description = start_work_str

    new_card = backlog.add_card(name, description)
    new_card.set_due(datetime.datetime.combine(due_date, datetime.time(12, 0)))
    create_dates.position_card(board, new_card)
Exemplo n.º 9
0
def sort_backlog(board):
    backlog = trello_utility.get_list('Backlog', board)
    last_pos = 0

    for card in backlog.list_cards():
        pos = card.pos
        if not election_utility.is_date_card(card):
            card_date = card_position_date(card)
            if card_date:
                pos = card_date.timestamp()
            else:
                pos = last_pos + 1
        else:
            continue
        print("setting " + card.name + " to " + str(pos))
        card.set_pos(pos)
        last_pos = pos
Exemplo n.º 10
0
def sort_dates(board):
    backlog = trello_utility.get_list('Backlog', board)

    for date_card in backlog.list_cards():
        if election_utility.is_date_card(date_card):
            date = date_card.due_date.timestamp()
            after_card = False
            last_card = False
            for card in backlog.list_cards():
                if not election_utility.is_date_card(card):
                    if card.pos > date:
                        after_card = card
                        break
                    last_card = card
            if after_card and last_card:
                print("Inserting " + date_card.name + ' between ' +
                      last_card.name + ' and ' + after_card.name)
                date_card.set_pos((last_card.pos + after_card.pos) / 2)
Exemplo n.º 11
0
def sort_board(board):
    backlog = trello_utility.get_list('Backlog', board)
    last_pos = 0

    for card in backlog.list_cards():
        pos = card.pos
        if election_utility.is_date_card(card):
            dd = card.due_date.date()
            dt = datetime.datetime.combine(dd, datetime.time(1, 0))
            pos = dt.timestamp()
        else:
            card_date = card_position_date(card)
            if card_date:
                pos = datetime.datetime.combine(card_date.date(),
                                                datetime.time(12,
                                                              0)).timestamp()
            else:
                pos = last_pos + 1
        card.set_pos(pos)
        last_pos = pos
def produce_sorry_we_missed_you_card(board):
    start_date = datetime.date.today() + datetime.timedelta(days=2)
    collect_photos_time = datetime.timedelta(days=5)
    photo_due = start_date + collect_photos_time
    design_time = datetime.timedelta(days=2)
    design_due = photo_due + design_time
    print_time = datetime.timedelta(days=7)

    delivery_date = design_due + print_time

    goal_name = "Out cards"
    backlog = trello_utility.get_list("Backlog", board)
    goal_card = backlog.add_card(goal_name)
    goal_card.add_label(trello_utility.get_label('Goal', board))

    goal_label = trello_utility.create_label(goal_name, "null", board)
    goal_card.add_label(goal_label)
    goal_card.set_due(delivery_date)

    prereqs = [Prereq("Print out cards", delivery_date, delivery_date - print_time, [
        Prereq("Design cards", design_due, photo_due, [
            Prereq("Collect candidate photos", photo_due, start_date, [])
        ])])]
    ward_newsletter.add_prereqs(goal_card, prereqs, board, goal_label, backlog)