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

self-review fixes

parent fa93f95f
No related branches found
No related tags found
1 merge request!57Feature/survey locking system
......@@ -66,8 +66,6 @@ SURVEY_STATUS_RESPONSE_SCHEMA = {
class VerificationStatus(str, Enum):
New = "new" # a question that was not answered last year
Answered = "answered" # a question that was not answered last year but has an answer now
Unverified = "unverified" # a question that has its answered copied from last year
Verified = "verified" # a question for which last years answer was verified
Edited = "edited" # a question for which last years answer was edited
......
This diff is collapsed.
......@@ -18,8 +18,6 @@ export interface Nren {
}
export enum VerificationStatus {
New = "new", // a question that was not answered last year
Answered = "answered", // a question that was not answered last year but has an answer now
Unverified = "unverified", // a question that has its answered copied from last year
Verified = "verified", // a question for which last years answer was verified
Edited = "edited" // a question for which last years answer was edited
......
......@@ -71,9 +71,7 @@ function SurveyComponent({ surveyModel, verificationStatus }) {
surveyModel.onValueChanged.add(function (survey, options) {
const currentStatus = verificationStatus.current.get(options.question.name);
if (currentStatus == VerificationStatus.New) {
setVerifyButton(options.question, VerificationStatus.Answered);
} else if (currentStatus == VerificationStatus.Unverified) {
if (currentStatus == VerificationStatus.Unverified) {
setVerifyButton(options.question, VerificationStatus.Edited);
}
});
......
......@@ -39,7 +39,6 @@ function SurveyNavigationComponent({ surveyModel, surveyActions, year, nren, chi
}
const renderButton = (text, action) => {
// TODO styling of the buttons, add sv-footer__complete-btn for complete button, and save button perhaps too?
return (
<button className="sv-btn sv-btn--navigation" onClick={() => doSurveyAction(action)}>
{text}
......@@ -56,7 +55,7 @@ function SurveyNavigationComponent({ surveyModel, surveyActions, year, nren, chi
{editing && renderButton('Save and stop editing', 'saveAndStopEdit')}
{editing && renderButton('Save progress', 'save')}
{/* {(pageNo !== surveyModel.visiblePages.length - 1) && renderButton('Next Page', incrementPageNo)} */}
{/* {renderButton('Validate Page', validatePage)} */}
{/* {renderButton('Validate Page', 'validatePage')} */}
{/* {pageNo !== 0 && renderButton('Previous Page', decrementPageNo)} */}
</div>
);
......
......@@ -130,8 +130,8 @@
.survey-edit-buttons-block {
display: flex;
align-items: center;
justify-content: center;
align-items: center;
justify-content: center;
padding: 1em;
}
......
......@@ -2,7 +2,8 @@ import json
import jsonschema
from compendium_v2.db.auth_model import User
from compendium_v2.db.survey_model import ResponseStatus
from compendium_v2.routes.response import SURVEY_RESPONSE_SCHEMA, VerificationStatus, SURVEY_LOCK_SCHEMA
from compendium_v2.routes.response import SURVEY_RESPONSE_SCHEMA, VerificationStatus, SURVEY_LOCK_SCHEMA, \
SURVEY_STATUS_RESPONSE_SCHEMA
def test_response_route_try_response(client, test_survey_data):
......@@ -100,6 +101,7 @@ def test_response_route_load_lock_save_response(client, test_survey_data, mocked
})
assert rv.status_code == 200
result = json.loads(rv.data.decode('utf-8'))
jsonschema.validate(result, SURVEY_STATUS_RESPONSE_SCHEMA)
assert result.get('mode') == 'display'
rv = client.get('/api/response/load/2022/nren2', headers={'Accept': ['application/json']})
......@@ -132,6 +134,7 @@ def test_response_route_unlock(client, test_survey_data, mocked_user):
rv = client.post('/api/response/unlock/2022/nren2', headers={'Accept': ['application/json']})
assert rv.status_code == 200
result = json.loads(rv.data.decode('utf-8'))
jsonschema.validate(result, SURVEY_STATUS_RESPONSE_SCHEMA)
assert result.get('locked_by') == ''
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment