def show_operators(): query = OperatorQuery(get_db_session()) operators = query.get_operators() skills = query.get_not_certified_skills() return render_template('operators.html', operators=[x if x.ojt else x for x in operators], skills=skills)
def show_basic_setting(): team_id = request.args.get('team') session = get_db_session() team = UserQuery(session).get_team(team_id) skills = OperatorQuery(session).get_skills() operators = OperatorQuery(session).get_operators() return render_template('scheduler.html', team=team, skills=skills, operators=operators)
def show_monthly_setting(): team_id = request.args.get('team') session = get_db_session() team = UserQuery(session).get_team(team_id) operators = OperatorQuery(session).get_active_operators_of_team_id(team_id) return render_template('scheduler-monthly-setting.html', team=team, operators=operators)
def show_skills(): query = OperatorQuery(get_db_session()) return render_template('skills.html', skills=query.get_skills())
def show_myself(operator_id): query = OperatorQuery(get_db_session()) operator = query.get_operator(operator_id) skills = query.get_certified_skills() return render_template('operator.html', operator=operator, skills=skills)
def get_operators(): operators = OperatorQuery(get_db_session()).get_operators() return jsonize.json_response(jsonize.dumps(operators))
def set_test(self): self.init() session = self.create_session() # add teams team_facade = UserFacade(session) team1 = team_facade.append_team(Team.new('チーム1', '')) team_facade.append_team(Team.new('チーム2', '')) team_facade.append_team(Team.new('チーム3', '')) session.flush() # add users append_user = UserFacade(session).append_user append_user(User.new('user1', 'ユーザ1', team1, role=UserRole.OPERATOR)) user1 = append_user(User.new('user2', 'ユーザ2', team1, role=UserRole.OPERATOR)) user2 = append_user(User.new('user3', 'ユーザ3', team1, role=UserRole.OPERATOR)) user3 = append_user(User.new('user4', 'ユーザ4', team1, role=UserRole.OPERATOR)) session.flush() # add skills from domains.models.operator import Skill skill1 = Skill.new('スキル1', 1, is_certified=True) session.add(skill1) skill2 = Skill.new('スキル2', 3, is_certified=True) session.add(skill2) session.add(Skill.new('スキル3', 2, is_certified=True)) skill3 = Skill.new('スキル4', 5, is_certified=False) session.add(skill3) # add scheduler from datetime import time from backend.services import OperatorQuery from backend.services import SchedulerQuery from domains.models.scheduler import WorkCategory get_operator_of_user_id = OperatorQuery(session).get_operator_of_user_id work_daily = WorkCategory.new('勤務帯1', time(9, 30), time(18, 00), 7, 10, 3, 5, 0, 0, [get_operator_of_user_id(user1.id), get_operator_of_user_id(user2.id)], [], [], [], []) scheduler = SchedulerQuery(session).get_scheduler_of_team_id(team1.id) scheduler.work_categories.append(work_daily) scheduler.work_categories.append( WorkCategory.new('勤務帯2', time(17, 30), time(10, 00), 3, 5, 3, 5, 1, 5, [], [], [skill3], [], [get_operator_of_user_id(user3.id)]) ) session.flush() # add scheduler calendar from utils.date import get_next_month from domains.models.scheduler import MonthlySetting next_month = get_next_month() monthly_setting = MonthlySetting.new(scheduler.work_categories, next_month.month, next_month.year) monthly_setting.is_published = True scheduler.monthly_settings.append(monthly_setting) session.flush() session.commit() session.close()
def get_operator_id(): operator_query = OperatorQuery(get_db_session()) return operator_query.get_operator_of_user_id( current_user.id).id if current_user.is_authenticated else ""
def show_my_request(): operator = OperatorQuery(get_db_session()).get_operator_of_user_id( current_user.id) return render_template('request.html', current_operator=operator)