Ejemplo n.º 1
0
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
Ejemplo n.º 2
0
def produce_list_report(board, backlog):
    date_label = trello_utility.get_label('Date', board)
    goal_label = trello_utility.get_label('Goal', board)
    report = Report()
    for card in backlog.list_cards():
        if card.labels and date_label in card.labels:
            report.add_date(card.name)
        elif card.labels and goal_label in card.labels:
            report.add_goal_card(card)
        else:
            report.add_regular_card(card)

    return report
Ejemplo n.º 3
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)
Ejemplo n.º 4
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)
Ejemplo n.º 5
0
def is_date_card(card: trello.Card):
    date_label = trello_utility.get_label("Date", card.board)
    if not date_label:
        raise Exception("Board doesn't have date label")
    if card.labels:
        return date_label in card.labels
    else:
        return False
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())
Ejemplo n.º 7
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()
Ejemplo n.º 8
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)
Ejemplo n.º 9
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
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)