Exemple #1
0
def zeroing():
    begin = utils.now().replace(hour=0, minute=0, second=0, microsecond=0)
    tasks = Task.query.filter(Task.start_time > utils.get_current_monday(),
                              Task.start_time < utils.now())
    burnings = {}
    for task in tasks:
        if task.status == 'PROGRESS':
            task.status = 'READY'
            end_time = utils.now()
            if end_time.hour > 18:
                end_time = end_time.replace(hour=18, minute=0, second=0)
            task.time_slots.append(
                TimeSlot(task.start_time,
                         (end_time - task.start_time).total_seconds(),
                         task.owner,
                         partner=task.partner))
            task.owner = None
            task.partner = None
        burning = burnings.setdefault(task.team.id, Burning(task.team, begin))
        burning.add(task)

    for key, item in burnings.iteritems():
        db.session.add(item)
    db.session.commit()
Exemple #2
0
            team=Team.query.get(1),
            start_time=miami.utils.yestoday().replace(hour=14),
            ready_time=miami.utils.yestoday().replace(hour=14))
ts = TimeSlot(task.start_time, 3600, User.query.get(2))
task.categories.append(Category.query.get(2))
task.time_slots.append(ts)
db.session.add(task)
db.session.commit()

task = Task('title8', 'detail4', status='NEW', team=Team.query.get(1))
task.categories.append(Category.query.get(2))
db.session.add(task)
db.session.commit()

task = Task('title9', 'detail4', status='NEW', team=Team.query.get(1))
task.categories.append(Category.query.get(2))
db.session.add(task)
db.session.commit()

burning = Burning(Team.query.get(1), miami.utils.get_current_monday())
burning.burning = 1
burning.remaining = 10
db.session.add(burning)
db.session.commit()

burning = Burning(Team.query.get(1),
                  miami.utils.get_current_monday() + timedelta(days=1))
burning.burning = 2
burning.remaining = 8
db.session.add(burning)
db.session.commit()