def GET(self): finalschedules = FinalScheduleTable.select(0, 'all') finalusers = FinalUserTable.select(0, 'all') schedules = ScheduleTable.select(0, 0, 'all') users = UserTable.select(0, 0, 'all') for finalschedule in finalschedules: FinalScheduleTable.delete() for finaluser in finalusers: name = finaluser.s_name FinalUserTable.delete(name) for schedule in schedules: if schedule.keep: FinalScheduleTable.insert(schedule.s_name, schedule.s_time) else: sid=schedule.id ScheduleTable.delete(sid, 0, 'id') for user in users: if user.s_type == 0: FinalUserTable.insert(user.s_name, user.time_duty) raise web.seeother('/schedule/data')
def strikeUndo(sid): schedule = ScheduleTable.select(sid, 0, 'id') name = schedule[0].s_name user = UserTable.select(sid, name, 'name') duty = user[0].time_duty + 1 ScheduleTable.update(sid, '1') UserTable.update(name, duty)
def GET(self, sid): schedule = ScheduleTable.select(sid, 0, 'id') name = schedule[0].s_name user = UserTable.select(0, name, 'name') duty = user[0].time_duty + 1 ScheduleTable.update(sid, '1') UserTable.update(name, duty) raise web.seeother('/schedule/data')
def data(): user = UserTable.select(0, web.ctx.session.s_name, 'name') my_type = user[0].s_type if my_type == 0: schedules = ScheduleTable.select(0, web.ctx.session.s_name, 'norder') return (my_type, (schedules)) elif my_type == 1: schedules = ScheduleTable.select(0, 0, 'order') users = UserTable.select(0, 0, 'order') return (my_type, (schedules, users)) elif my_type == 2: schedules = FinalScheduleTable.select(0, 'order') users = FinalUserTable.select(0, 'order') return (my_type, (schedules, users))
def launch(): finalschedules = FinalScheduleTable.select(0, 'all') finalusers = FinalUserTable.select(0, 'all') schedules = ScheduleTable.select(0, 0, 'all') users = UserTable.select(0, 0, 'all') FinalScheduleTable.delete() for finaluser in finalusers: name = finaluser.s_name FinalUserTable.delete(name) for schedule in schedules: if schedule.keep: FinalScheduleTable.insert(schedule.s_name, schedule.s_time) else: sid=schedule.id ScheduleTable.delete(sid, 0, 'id') for user in users: if user.s_type == 0: FinalUserTable.insert(user.s_name, user.time_duty)
def userDelete(sid): user = UserTable.select(sid, 0, 'id') name = user[0].s_name UserTable.delete(sid) ScheduleTable.delete(0, name, 'name')