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): ...@@ -56,6 +56,9 @@ def convert_answers(answers):
mapped_answer.append(mapping.VALUE_TO_CODE_MAPPING[id][entry]) mapped_answer.append(mapping.VALUE_TO_CODE_MAPPING[id][entry])
answer = mapped_answer answer = mapped_answer
if id == 16504:
answer = '\n'.join(answer)
# code to convert my description in the mapping to a json structure # code to convert my description in the mapping to a json structure
question_names = question_name.split(":") question_names = question_name.split(":")
subdict = data subdict = data
...@@ -125,6 +128,8 @@ def _cli(app): ...@@ -125,6 +128,8 @@ def _cli(app):
for nren, answers in nren_surveys.items(): for nren, answers in nren_surveys.items():
survey_dict = convert_answers(answers) survey_dict = convert_answers(answers)
survey_dict["page"] = 0
survey_dict["verification_status"] = {}
response = SurveyResponse( response = SurveyResponse(
nren=nren, nren=nren,
nren_id=nren.id, nren_id=nren.id,
......
...@@ -183,7 +183,7 @@ ID_TO_NAME = { ...@@ -183,7 +183,7 @@ ID_TO_NAME = {
16501: "business_continuity_plans", # "Yes" "No" 16501: "business_continuity_plans", # "Yes" "No"
16502: "business_continuity_plans_specifics", 16502: "business_continuity_plans_specifics",
16503: "security_controls", # json list with double quotes 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", # 16505: "policy_comments",
16760: "policies:gender_equality_policy:available", # "Yes" "No" 16760: "policies:gender_equality_policy:available", # "Yes" "No"
16761: "policies:gender_equality_policy:url", 16761: "policies:gender_equality_policy:url",
...@@ -452,6 +452,16 @@ CONNECTION = { ...@@ -452,6 +452,16 @@ CONNECTION = {
"No - other reason / unsure": "no_other" "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 = { CHARGING_LEVELS = {
"Charges typically higher than for R+E users": "higher_than_r_e_charges", "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", "Same charging model as for R+E users": "same_as_r_e_charges",
...@@ -496,6 +506,16 @@ VALUE_TO_CODE_MAPPING = { ...@@ -496,6 +506,16 @@ VALUE_TO_CODE_MAPPING = {
"Integrity checking": "integrity_checking", "Integrity checking": "integrity_checking",
"Other": "other" "Other": "other"
}, },
16539: COVERED,
16540: COVERED,
16541: COVERED,
16542: COVERED,
16543: COVERED,
16544: COVERED,
16545: COVERED,
16546: COVERED,
16547: COVERED,
16548: COVERED,
16763: { 16763: {
"We participate in GEANT Crisis workshops such as CLAW": "geant_workshops", "We participate in GEANT Crisis workshops such as CLAW": "geant_workshops",
"No, we have not done any crisis exercises or trainings": "none", "No, we have not done any crisis exercises or trainings": "none",
......
...@@ -32,7 +32,7 @@ def test_queries(app_with_survey_db, mocker): ...@@ -32,7 +32,7 @@ def test_queries(app_with_survey_db, mocker):
responses = db.session.scalars(select(SurveyResponse).order_by(SurveyResponse.nren_id)).all() responses = db.session.scalars(select(SurveyResponse).order_by(SurveyResponse.nren_id)).all()
assert len(responses) == 1 assert len(responses) == 1
assert responses[0].answers == {"data": {}} assert responses[0].answers == {"data": {}, "page": 0, "verification_status": {}}
def test_conversion(): def test_conversion():
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment