示例#1
0
def fix_report(request, sql_session):
  Session.add(EmployeeGroup(n=1, name='admins'))
  Session.add(Employee(n=1,  name='NAME_1',
                       employee_group_n=1, disabled=False))
  # Этот тупой. Нет правильных ответов
  Session.add(Employee(n=2,  name='NAME_2',
                       employee_group_n=1, disabled=False))

  Session.add(Feature(n=1, name='FEATURE_1'))
  Session.add(Feature(n=2, name='FEATURE_2'))

  Session.add(Question(n=1, feature_n=1, txt='QUESTION_1', answer_n=12))
  Session.add(Answer(n=11, question_n=1, txt='ANSWER_11'))
  Session.add(Answer(n=12, question_n=1, txt='ANSWER_12'))

  Session.add(Question(n=2, feature_n=2, txt='QUESTION_2', answer_n=21))
  Session.add(Answer(n=21, question_n=2, txt='ANSWER_21'))
  Session.add(Answer(n=22, question_n=2, txt='ANSWER_22'))

  Session.add(Result(n=11, question_n=1, answer_n=12,
                     is_correct=True, employee_n=1, ddate=date.today()))
  Session.add(Result(n=12, question_n=1, answer_n=11,
                     is_correct=False, employee_n=2, ddate=date.today()))

  Session.add(Result(n=21, question_n=2, answer_n=21,
                     is_correct=True, employee_n=1, ddate=date.today() + timedelta(days=1)))
  Session.add(Result(n=22, question_n=2, answer_n=22,
                     is_correct=False, employee_n=2, ddate=date.today() + timedelta(days=1)))
示例#2
0
def fix_results(request, sql_session):
  Session.add(EmployeeGroup(n=1, name='admins'))
  Session.add(Employee(n=1,  name='NAME',
                       password='******', employee_group_n=1, disabled=False))

  Session.add(Feature(n=1, name='-'))
  Session.add(Feature(n=2, name='FEATURE1'))
  Session.add(Feature(n=3, name='FEATURE2'))
  # Session.commit()
  # Вопрос 1 к Теме 2
  Session.add(Question(n=21, feature_n=2, txt='CONTENT21', answer_n=211))
  Session.add(Answer(n=211, question_n=21, txt='CONTENT211'))
  Session.add(Answer(n=212, question_n=21, txt='CONTENT212'))
  Session.add(Answer(n=213, question_n=21, txt='CONTENT213'))

  # Вопрос 2 к Теме 2
  Session.add(Question(n=22, feature_n=2, txt='CONTENT22', answer_n=211))
  Session.add(Answer(n=221, question_n=22, txt='CONTENT221'))
  Session.add(Answer(n=222, question_n=22, txt='CONTENT222'))
  Session.add(Answer(n=223, question_n=22, txt='CONTENT223'))

  # Вопрос 1 к Теме 3
  Session.add(Question(n=31, feature_n=3, txt='CONTENT31', answer_n='311'))
  Session.add(Answer(n=311, question_n=31, txt='CONTENT311'))
  Session.add(Answer(n=312, question_n=31, txt='CONTENT312'))
  Session.add(Answer(n=313, question_n=31, txt='CONTENT313'))

  Session.add(Result(n=1, question_n=21, answer_n=211,
                     is_correct=True, employee_n=1))
  Session.add(Result(n=2, question_n=22, answer_n=221,
                     is_correct=False, employee_n=1))
示例#3
0
def fix_employees(request, sql_session):
  Session.add(EmployeeGroup(n=1, name='admins'))
  Session.add(Right(n=1, employee_group_n=1,
                    section='question', access='edit'))
  Session.add(Employee(n=1, name='NAME_1',
                       password='******', employee_group_n=1, disabled=False))
  Session.add(Employee(n=2, name='NAME_2',
                       password='******', employee_group_n=1, disabled=False))
示例#4
0
def fix_employees_for_plan(request, sql_session):
  Session.add(EmployeeGroup(n=1, name='SELLERS'))
  Session.add(Right(n=1, employee_group_n=1,
                    section='question', access='edit'))
  Session.add(Employee(n=1, name='EMPLOYEE1',
                       password='', employee_group_n=1, disabled=False))
  Session.add(Employee(n=2, name='EMPLOYEE2',
                       password='', employee_group_n=1, disabled=False))
  Session.add(Employee(n=3, name='EMPLOYEE_DISABLED',
                       password='', employee_group_n=1, disabled=True))
示例#5
0
def fix_for_pivot_create_feature_report(request, sql_session):
  Session.add(EmployeeGroup(n=2, name='SELLERS'))
  Session.add(Right(n=2, employee_group_n=1,
                    section='question', access='edit'))
  Session.add(Employee(n=2, name='EMPLOYEE_1',
                       password='', employee_group_n=2, disabled=False))
  Session.add(Employee(n=3, name='EMPLOYEE_2',
                       password='', employee_group_n=2, disabled=False))

  feature_group_1 = FeatureGroup(n=1, name='GROUP_1', parent_n=1)
  Session.add(feature_group_1)

  Session.add(Feature(n=1, name='FEATURE_11',
                      feature_group=[feature_group_1, ], employee_n=2, ddate=date.today()))
  Session.add(Feature(n=2, name='FEATURE_12',
                      feature_group=[feature_group_1, ], employee_n=2, ddate=date.today() + timedelta(days=1)))
  Session.add(Feature(n=3, name='FEATURE_21',
                      feature_group=[feature_group_1, ], employee_n=3, ddate=date.today()))
  Session.add(Feature(n=4, name='FEATURE_22',
                      feature_group=[feature_group_1, ], employee_n=3, ddate=date.today() + timedelta(days=1)))
示例#6
0
def fix_employees_for_test(request, sql_session):
  Session.add(EmployeeGroup(n=1, name='admins'))
  Session.add(Right(n=1, employee_group_n=1,
                    section='employee', access='edit'))
  Session.add(Right(n=3, employee_group_n=1,
                    section='question', access='edit'))
  Session.add(Right(n=4, employee_group_n=1,
                    section='answer', access='edit'))
  Session.add(Right(n=5, employee_group_n=1,
                    section='result', access='edit'))
  Session.add(Right(n=6, employee_group_n=1,
                    section='feature', access='edit'))
  Session.add(Right(n=7, employee_group_n=1,
                    section='department', access='edit'))
  Session.add(Right(n=8, employee_group_n=1,
                    section='plan', access='edit'))
  # Session.add(Employee(n=1,  name='NAME', password=crypt(
  #     'password', 'secret service'), employee_group_n=1))
  Session.add(Employee(n=1,  name='NAME',
                       password='******', employee_group_n=1))
示例#7
0
def fix_disabled_employees(request, sql_session):
  Session.add(EmployeeGroup(n=1, name='admins'))
  Session.add(Employee(n=1,  name='NAME',
                       password='******', employee_group_n=1, disabled=True))
示例#8
0
 def create_employee_group(name):
     params = {
         'name': name,
     }
     employee_group = EmployeeGroup.create(params)
     return employee_group
示例#9
0
 def test_model_sets_n_automatically(self):
     _group = EmployeeGroup(name='NAME_USERGROUP')
     Session.add(_group)
     Session.flush()
     assert _group.n is not None
     assert _group.name == 'NAME_USERGROUP'