Skip to content
Snippets Groups Projects
Commit 6ed852ae authored by Remco Tukker's avatar Remco Tukker
Browse files

fixes for conversion bugs that Daniel found

parent 8a972473
Branches
Tags
1 merge request!52Feature/admin workflow surveys page
......@@ -56,6 +56,9 @@ def convert_answers(answers):
mapped_answer.append(mapping.VALUE_TO_CODE_MAPPING[id][entry])
answer = mapped_answer
if id == 16504:
answer = '\n'.join(answer)
# code to convert my description in the mapping to a json structure
question_names = question_name.split(":")
subdict = data
......@@ -125,6 +128,8 @@ def _cli(app):
for nren, answers in nren_surveys.items():
survey_dict = convert_answers(answers)
survey_dict["page"] = 0
survey_dict["verification_status"] = {}
response = SurveyResponse(
nren=nren,
nren_id=nren.id,
......
......@@ -183,7 +183,7 @@ ID_TO_NAME = {
16501: "business_continuity_plans", # "Yes" "No"
16502: "business_continuity_plans_specifics",
16503: "security_controls", # json list with double quotes
16504: "security_controls-Comment",
16504: "security_controls-Comment", # json list with double quotes that should be mapped to string
# 16505: "policy_comments",
16760: "policies:gender_equality_policy:available", # "Yes" "No"
16761: "policies:gender_equality_policy:url",
......@@ -452,6 +452,16 @@ CONNECTION = {
"No - other reason / unsure": "no_other"
}
COVERED = {
"Yes - including transit to other networks": "yes_incl_other",
"Yes - national NREN access": "yes_national_nren",
"In some circumstances ": "sometimes",
"No - not eligible for policy reasons": "no_policy",
"No - financial restrictions (NREN is unable to charge/cover costs)": "no_financial",
"No - other reason": "no_other",
"Unsure/unclear": "unsure"
}
CHARGING_LEVELS = {
"Charges typically higher than for R+E users": "higher_than_r_e_charges",
"Same charging model as for R+E users": "same_as_r_e_charges",
......@@ -496,6 +506,16 @@ VALUE_TO_CODE_MAPPING = {
"Integrity checking": "integrity_checking",
"Other": "other"
},
16539: COVERED,
16540: COVERED,
16541: COVERED,
16542: COVERED,
16543: COVERED,
16544: COVERED,
16545: COVERED,
16546: COVERED,
16547: COVERED,
16548: COVERED,
16763: {
"We participate in GEANT Crisis workshops such as CLAW": "geant_workshops",
"No, we have not done any crisis exercises or trainings": "none",
......
......@@ -32,7 +32,7 @@ def test_queries(app_with_survey_db, mocker):
responses = db.session.scalars(select(SurveyResponse).order_by(SurveyResponse.nren_id)).all()
assert len(responses) == 1
assert responses[0].answers == {"data": {}}
assert responses[0].answers == {"data": {}, "page": 0, "verification_status": {}}
def test_conversion():
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment