Ejemplo n.º 1
0
 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)
Ejemplo n.º 2
0
 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)
Ejemplo n.º 3
0
 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]]))
Ejemplo n.º 4
0
 def new(team: Team):
     return Scheduler(UuidFactory.new_uuid(), team)
Ejemplo n.º 5
0
 def new(myself, colleague, affinity: int):
     return Relation(UuidFactory.new_uuid(), myself, colleague, affinity)
Ejemplo n.º 6
0
 def new(team_id: str, month: int, year: int,
         schedule_components: []):
     return Schedule(UuidFactory.new_uuid(), team_id, month,
                     year, schedule_components)
Ejemplo n.º 7
0
 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)
Ejemplo n.º 8
0
 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)
Ejemplo n.º 9
0
 def new(day: int, work_category_id: str):
     return DayWorkCategory(UuidFactory.new_uuid(), day, work_category_id)
Ejemplo n.º 10
0
 def generate_csrf_token():
     if 'csrf_token' not in session:
         session['csrf_token'] = UuidFactory().new_uuid()
     return session['csrf_token']
Ejemplo n.º 11
0
 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)
Ejemplo n.º 12
0
def get_uuid():
    uuid = UuidFactory.new_uuid()
    return jsonize.json_response(jsonize.dumps(uuid))
Ejemplo n.º 13
0
 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
Ejemplo n.º 14
0
 def new(name: str, note: str):
     return Team(UuidFactory.new_uuid(), name, note)
Ejemplo n.º 15
0
 def new(team: Team, month: int, year: int):
     return History(UuidFactory.new_uuid(), team, month, year,
                    ProcessStatus.START, 0)
Ejemplo n.º 16
0
 def new(name: str, score: int, is_certified: bool):
     return Skill(UuidFactory.new_uuid(), name, score, is_certified)
Ejemplo n.º 17
0
 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)
Ejemplo n.º 18
0
 def new(user: User):
     operator = Operator(UuidFactory.new_uuid(), user)
     return operator