Skip to content

Commit

Permalink
Remove the evaluator questions
Browse files Browse the repository at this point in the history
Add the evaluator framework lots routes
Add the evaluator framework lot sections routes
Add the evaluator framework lot section evaluations routes
  • Loading branch information
tim-s-ccs committed Nov 18, 2024
1 parent 600307c commit bebc1b4
Show file tree
Hide file tree
Showing 5 changed files with 272 additions and 279 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

Records breaking changes from major version bumps

## 29.0.0

Update the lot questions reponses routes
Remove old evaluator questions routes
Add routes relating to evaluations

## 28.0.0

Make Python 3.11 the minimum supported version
Expand Down
2 changes: 1 addition & 1 deletion dmapiclient/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = '28.0.0'
__version__ = '29.0.0'

from .errors import APIError, HTTPError, InvalidResponse # noqa
from .errors import REQUEST_ERROR_STATUS_CODE, REQUEST_ERROR_MESSAGE # noqa
Expand Down
16 changes: 10 additions & 6 deletions dmapiclient/audit.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,16 @@ class AuditTypes(Enum):
update_lot_questions_response_answers = "update_lot_questions_response_answers"
complete_lot_questions_response = "complete_lot_questions_response"

# Evaluator questions
create_evaluator_question = "create_evaluator_question"
update_evaluator_question_assignment_status = "update_evaluator_question_assignment_status"
update_evaluator_question_answers = "update_evaluator_question_answers"
create_final_evaluator_question = "create_final_evaluator_question"
update_final_evaluator_question_answers = "update_final_evaluator_question_answers"
# Evaluations
update_evaluator_framework_lot_assignment_status = "update_evaluator_framework_lot_assignment_status"
create_evaluator_framework_lot = "create_evaluator_framework_lot"
update_evaluator_framework_lot_status = "update_evaluator_framework_lot_status"
create_evaluator_framework_lot_section = "create_evaluator_framework_lot_section"
update_evaluator_framework_lot_section_assignment_status = \
"update_evaluator_framework_lot_section_assignment_status"

create_evaluator_framework_lot_section_evaluation = "create_evaluator_framework_lot_section_evaluation"
update_evaluator_framework_lot_section_evaluation = "update_evaluator_framework_lot_section_evaluation"

@staticmethod
def is_valid_audit_type(test_audit_type):
Expand Down
171 changes: 90 additions & 81 deletions dmapiclient/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -410,27 +410,6 @@ def export_suppliers(self, framework_slug):
export_suppliers_iter = make_iter_method('export_suppliers', 'suppliers')
export_suppliers_iter.__name__ = str("export_suppliers_iter")

def find_framework_suppliers_with_evaluation_for_lot(
self,
framework,
lot,
page=None,
):
params = {}

if page is not None:
params['page'] = page

return self._get(
f"/frameworks/{framework}/suppliers/lots/{lot}/evaluations",
params=params
)

find_framework_suppliers_with_evaluation_for_lot_iter = \
make_iter_method('find_framework_suppliers_with_evaluation_for_lot', 'supplierFrameworks')
find_framework_suppliers_with_evaluation_for_lot_iter.__name__ = \
str("find_framework_suppliers_with_evaluation_for_lot_iter")

# Users

def create_user(self, user):
Expand Down Expand Up @@ -1529,31 +1508,35 @@ def find_lot_questions_responses(
)

params = {
'framework': framework_slug,
'supplier_id': supplier_id,
'page': page,
}

return self._get(f"/suppliers/{supplier_id}/frameworks/{framework_slug}/lot-questions-responses", params=params)
return self._get("/lot-questions-responses", params=params)

find_lot_questions_responses_iter = make_iter_method('find_lot_questions_responses', 'lotQuestionsResponses')
find_lot_questions_responses_iter.__name__ = str("find_lot_questions_responses_iter")

def get_lot_questions_response(self, supplier_id, framework_slug, lot_slug):
return self._get(
f"/suppliers/{supplier_id}/frameworks/{framework_slug}/lot-questions-responses/{lot_slug}"
)

def create_lot_questions_response(self, supplier_id, framework_slug, lot_slug, user=None):
return self._post_with_updated_by(
f"/suppliers/{supplier_id}/frameworks/{framework_slug}/lot-questions-responses/{lot_slug}",
data={},
"/lot-questions-responses",
data={
"supplierId": supplier_id,
"frameworkSlug": framework_slug,
"lotSlug": lot_slug,
},
user=user,
)

def get_lot_questions_response(self, lot_questions_response_id):
return self._get(
f"/lot-questions-responses/{lot_questions_response_id}"
)

def update_lot_questions_response(
self,
supplier_id,
framework_slug,
lot_slug,
lot_questions_response_id,
lot_questions_response,
user=None,
page_questions=None
Expand All @@ -1566,28 +1549,25 @@ def update_lot_questions_response(
data['page_questions'] = page_questions

return self._patch_with_updated_by(
f"/suppliers/{supplier_id}/frameworks/{framework_slug}/lot-questions-responses/{lot_slug}",
f"/lot-questions-responses/{lot_questions_response_id}",
data=data,
user=user,
)

def complete_lot_questions_response(self, supplier_id, framework_slug, lot_slug, user=None):
def complete_lot_questions_response(self, lot_questions_response_id, user=None):
return self._post_with_updated_by(
f"/suppliers/{supplier_id}/frameworks/{framework_slug}/lot-questions-responses/{lot_slug}/complete",
f"/lot-questions-responses/{lot_questions_response_id}/complete",
data={},
user=user,
)

# Evaluator questions
# Evaluations

def find_evaluator_questions(
def find_evaluator_framework_lots(
self,
framework,
lot,
user_id=None,
supplier_id=None,
question_id=None,
status=None,
assigned=True,
page=None,
):
Expand All @@ -1597,75 +1577,104 @@ def find_evaluator_questions(
'assigned': bool(assigned),
'page': page,
'user_id': user_id,
'supplier_id': supplier_id,
'question_id': question_id,
'status': status
}

return self._get("/evaluator-questions", params=params)
return self._get("/evaluations/evaluator-framework-lots", params=params)

find_evaluator_questions_iter = make_iter_method('find_evaluator_questions', 'evaluatorQuestions')
find_evaluator_questions_iter.__name__ = str("find_evaluator_questions_iter")
find_evaluator_framework_lots_iter = make_iter_method('find_evaluator_framework_lots', 'evaluatorFrameworkLots')
find_evaluator_framework_lots_iter.__name__ = str("find_evaluator_framework_lots")

def find_evaluator_question_users(self, framework, lot, page=None):
return self._get(
f"/evaluator-questions/{framework}/{lot}/users",
params={
'page': page
}
)

def get_evaluator_question(self, evaluator_question_id):
return self._get(
f"/evaluator-questions/{evaluator_question_id}"
def update_assigned_evaluators_for_framework_lot(
self,
framework,
lot,
users,
user=None
):
return self._post_with_updated_by(
"/evaluations/evaluator-framework-lots",
data={
'evaluatorFrameworkLots': {
'frameworkSlug': framework,
"lotSlug": lot,
'users': users,
}
},
user=user,
)

def get_final_evaluator_question(self, framework, lot, supplier_id, question_id):
return self._get(
f"/evaluator-questions/{framework}/{lot}/{supplier_id}/{question_id}/final",
def update_evaluator_framework_lot_status(
self,
evaluator_framework_lot_id,
status,
user=None
):
return self._post_with_updated_by(
f"/evaluations/evaluator-framework-lots/{evaluator_framework_lot_id}/status/{status}",
data={},
user=user,
)

def update_evaluator_question(self, evaluator_question_id, elvauator_question, user=None):
return self._patch_with_updated_by(
f"/evaluator-questions/{evaluator_question_id}",
def update_assigned_sections_for_evaluator_framework_lot(
self,
framework,
lot,
section_slug,
evaluator_framework_lots,
user=None
):
return self._post_with_updated_by(
"/evaluations/evaluator-framework-lot-sections",
data={
"evaluatorQuestions": elvauator_question,
'evaluatorFrameworkLotSections': {
'evaluatorFrameworkLots': evaluator_framework_lots,
'frameworkSlug': framework,
"lotSlug": lot,
'sectionSlug': section_slug,
}
},
user=user,
)

def set_final_evaluator_question(
def get_evaluator_framework_lot_section_evaluation(
self,
framework,
lot,
evaluator_framework_lot_section_evaluation_id,
):
return self._get(
"/evaluations/evaluator-framework-lot-section-evaluations/"
f"{evaluator_framework_lot_section_evaluation_id}"
)

def create_evaluator_framework_lot_section_evaluation(
self,
evaluator_framework_lot_section_id,
supplier_id,
question_id,
elvauator_question,
evaluator_framework_lot_section_evaluation,
page_questions,
user=None
):
return self._post_with_updated_by(
f"/evaluator-questions/{framework}/{lot}/{supplier_id}/{question_id}/final",
'/evaluations/evaluator-framework-lot-section-evaluations',
data={
"evaluatorQuestions": elvauator_question,
'evaluatorFrameworkLotSectionId': evaluator_framework_lot_section_id,
'supplierId': supplier_id,
'evaluatorFrameworkLotSectionEvaluations': evaluator_framework_lot_section_evaluation,
'page_questions': page_questions
},
user=user,
)

def update_assigned_evaluators_for_question(
def update_evaluator_framework_lot_section_evaluation(
self,
framework,
lot,
supplier_id,
question_id,
users,
evaluator_framework_lot_section_evaluation_id,
evaluator_framework_lot_section_evaluation,
user=None
):
return self._post_with_updated_by(
f"/evaluator-questions/{framework}/{lot}/{supplier_id}/{question_id}",
'/evaluations/evaluator-framework-lot-section-evaluations'
f'/{evaluator_framework_lot_section_evaluation_id}',
data={
'evaluatorQuestions': {
'users': users
}
'evaluatorFrameworkLotSectionEvaluations': evaluator_framework_lot_section_evaluation,
},
user=user,
)
Loading

0 comments on commit bebc1b4

Please sign in to comment.