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 attend(sid): schedule = FinalScheduleTable.select(sid, 'id') name = schedule[0].s_name user = FinalUserTable.select(name, 'name') actual = user[0].time_actual + 1 FinalUserTable.update(name, actual, 'Vars') FinalScheduleTable.update(sid, 0, 0, '1', 'Fs')
def coverPerson(sid): myperson = web.input().get('person') result = FinalUserTable.select(myperson, 'name') if not result: return False FinalScheduleTable.update(sid, 0, myperson, '1', 'PFs') schedule = FinalScheduleTable.select(sid, 'id') user = FinalUserTable.select(myperson, 'name') actual = user[0].time_actual + 1 FinalUserTable.update(myperson, actual, 'Vars') return True
def undo(sid): schedule = FinalScheduleTable.select(sid, 'id') myschedule = schedule[0] change = myschedule.ischange if not change: name = myschedule.s_name else: name = myschedule.person user = FinalUserTable.select(name, 'name') actual = user[0].time_actual - 1 FinalUserTable.update(name, actual, 'Vars') FinalScheduleTable.update(sid, '0', 0, '0', 'FsCh')
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 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 scheduleclear(): schedules = FinalScheduleTable.select(0, 'all') for schedule in schedules: sid = schedule.id FinalScheduleTable.update(sid, '0', 0, '0', 'FsCh')
def coverUndo(sid): FinalScheduleTable.update(sid, '0', 0, 0, 'IsC')
def cover(sid): FinalScheduleTable.update(sid, '1', 0, 0, 'IsC')