Skip to content

Commit

Permalink
Merge pull request #1891 from uktrade/dev
Browse files Browse the repository at this point in the history
UAT Release
  • Loading branch information
currycoder authored Apr 15, 2024
2 parents 680d180 + e2b7332 commit 8072d79
Show file tree
Hide file tree
Showing 9 changed files with 324 additions and 50 deletions.
2 changes: 1 addition & 1 deletion Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ setuptools = "~=65.5.1"
rules="~=3.3.0"
django-extra-views = "~=0.14.0"
djangorestframework = "~=3.14.0"
django = "~=4.2.10"
django = "~=4.2.11"

[requires]
python_version = "3.9"
29 changes: 15 additions & 14 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 2 additions & 7 deletions caseworker/advice/rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,12 @@ def can_ncsc_make_recommendation(user, case, queue_alias):


def can_desnz_make_recommendation(user, case, queue_alias):
# TODO: Remove BEIS queue aliases when DESNZ aliases in lite-api
if queue_alias not in (
services.DESNZ_CHEMICAL_CASES_TO_REVIEW,
services.DESNZ_NUCLEAR_CASES_TO_REVIEW,
"BEIS_CHEMICAL_CASES_TO_REVIEW",
"BEIS_NUCLEAR_CASES_TO_REVIEW",
):
return False
# TODO: Remove BEIS queue alias when DESNZ alias in lite-api
if queue_alias == services.DESNZ_NUCLEAR_CASES_TO_REVIEW or queue_alias == "BEIS_NUCLEAR_CASES_TO_REVIEW":
if queue_alias == services.DESNZ_NUCLEAR_CASES_TO_REVIEW:
return len(services.unassessed_trigger_list_goods(case)) == 0

return True
Expand All @@ -56,8 +52,7 @@ def can_user_make_recommendation(request, case):
return can_fcdo_make_recommendation(user, case, queue_alias)
if team in services.MOD_CONSOLIDATE_TEAMS:
return can_mod_make_recommendation(user, case, queue_alias)
# TODO: Remove BEIS team aliases when DESNZ aliases in lite-api
if team in services.DESNZ_TEAMS or team in services.BEIS_TEAMS:
if team in services.DESNZ_TEAMS:
return can_desnz_make_recommendation(user, case, queue_alias)
if team == services.NCSC_TEAM:
return can_ncsc_make_recommendation(user, case, queue_alias)
Expand Down
21 changes: 3 additions & 18 deletions caseworker/advice/services.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@
DESNZ_CHEMICAL,
DESNZ_NUCLEAR,
]
# TODO: Remove BEIS team aliases when DESNZ team aliases in lite-api
BEIS_TEAMS = ["BEIS_CHEMICAL", "BEIS_NUCLEAR"]
FCDO_TEAM = "FCO"
LICENSING_UNIT_TEAM = "LICENSING_UNIT"
MOD_ECJU_TEAM = "MOD_ECJU"
Expand Down Expand Up @@ -542,17 +540,13 @@ def get_advice_tab_context(case, caseworker, queue_id):
"assess_trigger_list_products": False,
},
}
# TODO: Remove BEIS team aliases when DESNZ aliases in lite-api
if team_alias in (FCDO_TEAM, *MOD_CONSOLIDATE_TEAMS, *DESNZ_TEAMS, *BEIS_TEAMS, NCSC_TEAM):
# TODO: Remove BEIS queue aliases when DESNZ aliases in lite-api
if team_alias in (FCDO_TEAM, *MOD_CONSOLIDATE_TEAMS, *DESNZ_TEAMS, NCSC_TEAM):
if queue_alias in (
FCDO_CASES_TO_REVIEW_QUEUE,
FCDO_CPACC_CASES_TO_REVIEW_QUEUE,
*MOD_CONSOLIDATE_QUEUES,
DESNZ_CHEMICAL_CASES_TO_REVIEW,
DESNZ_NUCLEAR_CASES_TO_REVIEW,
"BEIS_CHEMICAL_CASES_TO_REVIEW",
"BEIS_NUCLEAR_CASES_TO_REVIEW",
NCSC_CASES_TO_REVIEW,
):
existing_advice = get_my_advice(case.advice, caseworker["id"])
Expand All @@ -565,18 +559,9 @@ def get_advice_tab_context(case, caseworker, queue_id):
context["buttons"]["move_case_forward"] = True

# DESNZ Nuclear need to assess products first before giving recommendation
# TODO: Remove BEIS team alias when DESNZ alias in lite-api
# TODO: Remove BEIS queue alias when DESNZ alias in lite-api
if (
(team_alias == DESNZ_NUCLEAR or team_alias == "BEIS_NUCLEAR")
and (queue_alias == DESNZ_NUCLEAR_CASES_TO_REVIEW or queue_alias == "BEIS_NUCLEAR_CASES_TO_REVIEW")
and not existing_advice
):
if (team_alias == DESNZ_NUCLEAR) and (queue_alias == DESNZ_NUCLEAR_CASES_TO_REVIEW) and not existing_advice:
context["buttons"]["assess_trigger_list_products"] = len(unassessed_trigger_list_goods(case)) > 0
# TODO: Remove BEIS queue alias when DESNZ queue alias in lite-api
elif queue_alias == FCDO_COUNTERSIGNING_QUEUE or (
queue_alias == DESNZ_NUCLEAR_COUNTERSIGNING or queue_alias == "BEIS_NUCLEAR_COUNTERSIGNING"
):
elif queue_alias == FCDO_COUNTERSIGNING_QUEUE or (queue_alias == DESNZ_NUCLEAR_COUNTERSIGNING):
advice_to_countersign = get_advice_to_countersign(case.advice, caseworker)
countersigned_by = get_countersigners(advice_to_countersign)

Expand Down
4 changes: 2 additions & 2 deletions caseworker/external_data/example.csv
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
reference,name,address,notifying_government,final_destination,item_list_codes,item_description,consignee_name,end_use,field_one,field_two,field_n
ABC123,44,123 fake street,France,Germany,ABC123,Grapes,Fred Example,Used in car,value_one,value_two,value_n
reference,regime_reg_ref,name,address,notifying_government,country,item_list_codes,item_description,consignee_name,end_use,reason_for_refusal,spire_entity_id
DN2000/0000,AB-CD-EF-000,Organisation Name,"1000 Street Name, City Name",Country Name,Country Name,0A00100,Medium Size Widget,Example Name,Used in industry,Risk of outcome,123
12 changes: 8 additions & 4 deletions exporter/applications/helpers/check_your_answers.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def _convert_standard_application(application, editable=False, is_summary=False)
product_location = {"Product location and journey": _get_product_location_and_journey(application)}
converted = {**product_location, **converted}

if has_incorporated_goods(application):
if has_ultimate_end_users(application) and has_incorporated_goods_on_application(application):
ultimate_end_users = [convert_party(item, application, editable) for item in application["ultimate_end_users"]]
converted[strings.ULTIMATE_END_USERS] = ultimate_end_users

Expand Down Expand Up @@ -706,9 +706,13 @@ def is_application_export_type_permanent(application):
return False if not application.get("export_type") else (application.get("export_type").get("key") == PERMANENT)


def has_incorporated_goods(application):
for good in application["goods"]:
if good["is_good_incorporated"]:
def has_ultimate_end_users(application):
return bool(application["ultimate_end_users"])


def has_incorporated_goods_on_application(application):
for goa in application["goods"]:
if goa.get("is_good_incorporated") or goa.get("is_onward_incorporated"):
return True

return False
Expand Down
6 changes: 2 additions & 4 deletions exporter/templates/includes/ecju-queries.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,9 @@ <h3 class="govuk-heading-m">Open queries</h3>
{% for ecju_query in open_queries %}
<div class="app-ecju-query" id="open-ecju-query">
<div class="app-ecju-query__item">
<!-- TODO: Remove BEIS team alias when DESNZ alias in lite-api -->
{% if ecju_query.team.alias == "BEIS_CHEMICAL" or ecju_query.team.alias == "DESNZ_CHEMICAL" %}
{% if ecju_query.team.alias == "DESNZ_CHEMICAL" %}
<p class="app-ecju-query__heading">DESNZ Chemical</p>
<!-- TODO: Remove BEIS team alias when DESNZ alias in lite-api -->
{% elif ecju_query.team.alias == "BEIS_NUCLEAR" or ecju_query.team.alias == "DESNZ_NUCLEAR" %}
{% elif ecju_query.team.alias == "DESNZ_NUCLEAR" %}
<p class="app-ecju-query__heading">DESNZ Nuclear</p>
{% else %}
<p class="app-ecju-query__heading">{{ ecju_query.team.name }}</p>
Expand Down
145 changes: 145 additions & 0 deletions unit_tests/exporter/applications/views/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,151 @@ def good_on_application(data_standard_case):
}


@pytest.fixture
def data_goa_good_incorporated(data_standard_case):
return {
"id": str(uuid.uuid4()),
"created_at": "2024-03-26T15:22:35.714893Z",
"updated_at": "2024-03-26T15:22:35.714893Z",
"good": {
"id": str(uuid.uuid4()),
"name": "medium shotgun component",
"description": "",
"part_number": "",
"no_part_number_comments": "",
"control_list_entries": [
{
"id": "0b9116c2-3aa0-49fb-a590-944b4738b208", # /PS-IGNORE
"rating": "ML1a",
"text": "Rifles and combination guns, handguns, machine, sub-machine and volley guns",
}
],
"is_good_controlled": {"key": "True", "value": "Yes"},
"flags": [],
"documents": [],
"is_pv_graded": "no",
"status": {"key": "draft", "value": "Draft"},
"item_category": {"key": "group2_firearms", "value": "Firearm"},
"is_document_available": False,
"no_document_comments": "asdf",
"firearm_details": {
"type": {
"key": "components_for_firearms",
"value": "Components for firearms",
},
"year_of_manufacture": 0,
"calibre": "1",
"replica_description": "",
"is_covered_by_firearm_act_section_one_two_or_five": "No",
"is_covered_by_firearm_act_section_one_two_or_five_explanation": "",
"firearms_act_section": "",
"section_certificate_missing_reason": "",
"serial_numbers_available": "LATER",
"no_proof_mark_details": "",
"deactivation_standard": "",
"deactivation_standard_other": "",
"number_of_items": 1,
"serial_numbers": [],
"not_deactivated_to_standard_comments": "",
},
"is_precedent": False,
"product_description": "",
},
"application": data_standard_case["case"]["id"],
"quantity": 1.0,
"unit": {"key": "NAR", "value": "Items"},
"value": "1.00",
"is_good_incorporated": True,
"flags": [],
"control_list_entries": [],
"end_use_control": [],
"audit_trail": [],
"firearm_details": {
"type": {
"key": "components_for_firearms",
"value": "Components for firearms",
},
"year_of_manufacture": 0,
"calibre": "1",
"replica_description": "",
"is_covered_by_firearm_act_section_one_two_or_five": "No",
"is_covered_by_firearm_act_section_one_two_or_five_explanation": "",
"firearms_act_section": "",
"section_certificate_missing_reason": "",
"serial_numbers_available": "LATER",
"no_proof_mark_details": "",
"is_deactivated": False,
"deactivation_standard": "",
"deactivation_standard_other": "",
"number_of_items": 1,
"serial_numbers": [],
"not_deactivated_to_standard_comments": "",
},
"is_precedent": False,
"is_onward_altered_processed_comments": "",
"is_onward_incorporated_comments": "",
"regime_entries": [],
"nsg_list_type": "",
"nsg_assessment_note": "",
}


@pytest.fixture
def data_goa_onward_incorporated(data_standard_case):
return {
"id": str(uuid.uuid4()),
"created_at": "2024-03-25T10:54:01.465094Z",
"updated_at": "2024-03-25T10:54:01.465094Z",
"good": {
"id": str(uuid.uuid4()),
"name": "medium size widget",
"description": "",
"part_number": "asdf",
"no_part_number_comments": "",
"control_list_entries": [],
"is_good_controlled": {"key": "False", "value": "No"},
"flags": [],
"documents": [],
"is_pv_graded": "no",
"status": {"key": "draft", "value": "Draft"},
"item_category": {
"key": "group1_components",
"value": "Component, accessory or module",
},
"is_military_use": {"key": "no", "value": "No"},
"is_component": {
"key": "yes_general",
"value": "Yes, it's a general purpose component",
},
"uses_information_security": False,
"component_details": "asdf",
"information_security_details": "",
"is_document_available": False,
"no_document_comments": "asdf",
"is_precedent": False,
"product_description": "asdf",
},
"application": data_standard_case["case"]["id"],
"quantity": 1.0,
"unit": {"key": "NAR", "value": "Items"},
"value": "1.00",
"is_good_incorporated": False,
"flags": [],
"control_list_entries": [],
"end_use_control": [],
"audit_trail": [],
"is_precedent": False,
"is_onward_exported": True,
"is_onward_altered_processed": False,
"is_onward_altered_processed_comments": "",
"is_onward_incorporated": True,
"is_onward_incorporated_comments": "asdf",
"regime_entries": [],
"nsg_list_type": "",
"nsg_assessment_note": "",
}


@pytest.fixture
def mock_good_on_application_post(requests_mock, data_standard_case, good_on_application):
application = data_standard_case["case"]["data"]
Expand Down
Loading

0 comments on commit 8072d79

Please sign in to comment.