def new(date: DateTime, date_name: str, work_categories: [WorkCategory]): details = [ DayDetail.new( x, x.week_day_require if not is_holiday_(date) else x.holiday_require) for x in work_categories ] return DaySetting(UuidFactory.new_uuid(), date.day, date_name, is_holiday_(date), details)
def new(title: str, at_from: time, at_to: time, week_day_require: int, holiday_require: int, day_offs: int, max_times: int, week_day_operators: [Operator], holiday_operators: [Operator], essential_skills: [Skill], exclusive_operators: [Operator], impossible_operators: [Operator]): return WorkCategory(UuidFactory.new_uuid(), title, at_from, at_to, week_day_require, holiday_require, day_offs, max_times, week_day_operators, holiday_operators, essential_skills, exclusive_operators, impossible_operators)
def new(work_categories: [], month: int, year: int): calendar = SysCalendar() calendar.setfirstweekday(SUNDAY) monthdatescalendar = [ y for x in calendar.monthdatescalendar(year, month) for y in x if y.year == year and y.month == month ] days = [ DaySetting.new(x, day_abbr[x.weekday()], work_categories) for x in monthdatescalendar ] return MonthlySetting( UuidFactory.new_uuid(), month, year, days, len([x for x in monthdatescalendar if x.weekday() in [5, 6]]))
def new(team: Team): return Scheduler(UuidFactory.new_uuid(), team)
def new(myself, colleague, affinity: int): return Relation(UuidFactory.new_uuid(), myself, colleague, affinity)
def new(team_id: str, month: int, year: int, schedule_components: []): return Schedule(UuidFactory.new_uuid(), team_id, month, year, schedule_components)
def new(title: str, on_from: datetime, on_to: datetime, days_count: int): return Vacation(UuidFactory.new_uuid(), title, on_from, on_to, days_count)
def new(name: str, note: str, at_from: datetime, at_to: datetime, operator: Operator): return Request(UuidFactory.new_uuid(), name, note, at_from, at_to, operator)
def new(day: int, work_category_id: str): return DayWorkCategory(UuidFactory.new_uuid(), day, work_category_id)
def generate_csrf_token(): if 'csrf_token' not in session: session['csrf_token'] = UuidFactory().new_uuid() return session['csrf_token']
def new(title: str, on_from: date, on_to: date, at_from: time, at_to: time, participants: [Operator]): return FixedSchedule(UuidFactory.new_uuid(), title, on_from, on_to, at_from, at_to, participants)
def get_uuid(): uuid = UuidFactory.new_uuid() return jsonize.json_response(jsonize.dumps(uuid))
def new(login_id: str, name: str, team: Team, role: Role, **kwargs): user = User(UuidFactory.new_uuid(), login_id, 'p' + login_id, name, team, role) return user
def new(name: str, note: str): return Team(UuidFactory.new_uuid(), name, note)
def new(team: Team, month: int, year: int): return History(UuidFactory.new_uuid(), team, month, year, ProcessStatus.START, 0)
def new(name: str, score: int, is_certified: bool): return Skill(UuidFactory.new_uuid(), name, score, is_certified)
def new(operator: Operator, schedule: []): day_work_categories = [ DayWorkCategory.new(i + 1, x) for i, x in enumerate(schedule) ] return ScheduleComponent(UuidFactory.new_uuid(), operator, day_work_categories)
def new(user: User): operator = Operator(UuidFactory.new_uuid(), user) return operator