Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
compendium-v2
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
geant-swd
compendium-v2
Commits
6ed852ae
Commit
6ed852ae
authored
2 years ago
by
Remco Tukker
Browse files
Options
Downloads
Patches
Plain Diff
fixes for conversion bugs that Daniel found
parent
8a972473
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!52
Feature/admin workflow surveys page
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
compendium_v2/conversion/conversion.py
+5
-0
5 additions, 0 deletions
compendium_v2/conversion/conversion.py
compendium_v2/conversion/mapping.py
+21
-1
21 additions, 1 deletion
compendium_v2/conversion/mapping.py
test/test_conversion.py
+1
-1
1 addition, 1 deletion
test/test_conversion.py
with
27 additions
and
2 deletions
compendium_v2/conversion/conversion.py
+
5
−
0
View file @
6ed852ae
...
@@ -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
,
...
...
This diff is collapsed.
Click to expand it.
compendium_v2/conversion/mapping.py
+
21
−
1
View file @
6ed852ae
...
@@ -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
"
,
...
...
This diff is collapsed.
Click to expand it.
test/test_conversion.py
+
1
−
1
View file @
6ed852ae
...
@@ -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
():
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment