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
287122ff
Commit
287122ff
authored
2 years ago
by
Remco Tukker
Browse files
Options
Downloads
Patches
Plain Diff
handle survey metadata properly
parent
5a68a352
No related branches found
No related tags found
1 merge request
!49
Feature/comp 219 save button
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
compendium_v2/routes/survey.py
+2
-4
2 additions, 4 deletions
compendium_v2/routes/survey.py
survey-frontend/src/SurveyComponent.tsx
+6
-6
6 additions, 6 deletions
survey-frontend/src/SurveyComponent.tsx
with
8 additions
and
10 deletions
compendium_v2/routes/survey.py
+
2
−
4
View file @
287122ff
...
@@ -59,7 +59,7 @@ def open_survey(nren_name) -> Any:
...
@@ -59,7 +59,7 @@ def open_survey(nren_name) -> Any:
data
:
Optional
[
dict
]
=
None
data
:
Optional
[
dict
]
=
None
page
=
0
page
=
0
verification_status
=
{
"
budget
"
:
VerificationStatus
.
Unverified
,
"
TODO
"
:
"
remove or set all to new
"
}
verification_status
=
{}
response
=
db
.
session
.
scalar
(
response
=
db
.
session
.
scalar
(
select
(
SurveyResponse
).
where
(
SurveyResponse
.
survey_year
==
year
).
where
(
SurveyResponse
.
nren_id
==
nren
.
id
)
select
(
SurveyResponse
).
where
(
SurveyResponse
.
survey_year
==
year
).
where
(
SurveyResponse
.
nren_id
==
nren
.
id
)
...
@@ -74,10 +74,8 @@ def open_survey(nren_name) -> Any:
...
@@ -74,10 +74,8 @@ def open_survey(nren_name) -> Any:
verification_status
=
response
.
answers
[
"
verification_status
"
]
verification_status
=
response
.
answers
[
"
verification_status
"
]
elif
previous_response
:
elif
previous_response
:
# TODO add a 'migration' hook here for updating data per year
# TODO add a 'migration' hook here for updating data per year
# TODO i suppose we also need to remove the data that isnt asked anymore because
# i dont think the frontend will remove it
data
=
previous_response
.
answers
[
"
data
"
]
data
=
previous_response
.
answers
[
"
data
"
]
verification_status
=
{
"
budget
"
:
VerificationStatus
.
Unverified
,
"
TODO
"
:
"
all other questions
"
}
verification_status
=
{
question_name
:
VerificationStatus
.
Unverified
for
question_name
in
data
.
keys
()
}
open_survey
:
dict
=
{
open_survey
:
dict
=
{
"
model
"
:
survey
,
"
model
"
:
survey
,
...
...
This diff is collapsed.
Click to expand it.
survey-frontend/src/SurveyComponent.tsx
+
6
−
6
View file @
287122ff
...
@@ -73,11 +73,11 @@ function SurveyComponent({ nrenName }) {
...
@@ -73,11 +73,11 @@ function SurveyComponent({ nrenName }) {
const
survey
=
new
Model
(
json
[
'
model
'
]);
const
survey
=
new
Model
(
json
[
'
model
'
]);
if
(
json
[
'
data
'
]
!==
null
)
{
if
(
json
[
'
data
'
]
!==
null
)
{
survey
.
data
=
json
[
'
data
'
];
survey
.
data
=
json
[
'
data
'
];
}
survey
.
clearIncorrectValues
(
true
);
// TODO test if this really removes all old values and such
}
// TODO also use data and page info
survey
.
currentPageNo
=
json
[
'
page
'
];
survey
.
addNavigationItem
({
survey
.
addNavigationItem
({
id
:
"
sv-nav-compendium-complete
"
,
id
:
"
sv-nav-compendium-complete
"
,
...
@@ -129,7 +129,7 @@ function SurveyComponent({ nrenName }) {
...
@@ -129,7 +129,7 @@ function SurveyComponent({ nrenName }) {
const
saveData
=
{
const
saveData
=
{
data
:
sender
.
data
,
data
:
sender
.
data
,
page
:
2
,
page
:
sender
.
currentPageNo
,
verification_status
:
Object
.
fromEntries
(
verificationStatus
.
current
)
verification_status
:
Object
.
fromEntries
(
verificationStatus
.
current
)
}
}
xhr
.
send
(
JSON
.
stringify
(
saveData
));
xhr
.
send
(
JSON
.
stringify
(
saveData
));
...
...
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