-
Notifications
You must be signed in to change notification settings - Fork 175
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[LINST] Remove '_date' only for Standard Format #6923
Merged
driusan
merged 3 commits into
aces:main
from
zaliqarosli:2020-08-19-AppendDateOnlyForStandardFormat
Dec 21, 2020
Merged
[LINST] Remove '_date' only for Standard Format #6923
driusan
merged 3 commits into
aces:main
from
zaliqarosli:2020-08-19-AppendDateOnlyForStandardFormat
Dec 21, 2020
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
zaliqarosli
added
Category: Bug
PR or issue that aims to report or fix a bug
Release: Breaking changes
PR that contains changes that might impact the code or accepted practices of active projects
Cleanup
PR or issue introducing/requiring at least one clean-up operation
labels
Aug 19, 2020
@cmadjar @driusan @zaliqarosli I just want to say that I will use this PR from now on as an example for what testing instructions look like !!! |
ridz1208
requested changes
Nov 21, 2020
zaliqarosli
force-pushed
the
2020-08-19-AppendDateOnlyForStandardFormat
branch
from
November 24, 2020 00:10
13925b5
to
0fc309f
Compare
ridz1208
approved these changes
Nov 24, 2020
CamilleBeau
added
the
Passed manual tests
PR has been successfully tested by at least one peer
label
Nov 25, 2020
driusan
pushed a commit
that referenced
this pull request
Dec 23, 2020
…7260) These changes were made to reflect the #6923 which was issued to the main branch Additional changes not in #6923: modified the "stripping" function to only remove _date if it is positioned at the end of the field name. For example if the user names their date field my_date_of_release_date, previously the function would strip the field name to my; now it would only strip the last _date to become my_date_of_release removed the check for isset($dateformat) since the code is already converting a null $dateformat to an empty string 2 lines above ! reorganized the if statements to reduce over all complexity added an exception if the date format does not match any known formats
AlexandraLivadas
pushed a commit
to AlexandraLivadas/Loris
that referenced
this pull request
Jun 29, 2021
This fixes the removal of '_date' by only doing it for Standard Date formats. Currently, all date elements (standard, basic, and month/year) in linst instruments have their field names redefined as the substring appearing before '_date'. For example, if a date element is called 'enrolment_date_v2', the instrument field name becomes enrolment. This results in the save function trying to update a field called 'enrolment' in the instrument table which does not exist. The reason why this functionality existed is because the Standard Date format requires a field name ending with '_date'. Linst Standard Date formats are created by calling the NDB_BVL_Instrument class addDateElement() function which auto appends '_date' to the date element name. In order to avoid '_date' appearing twice, the NDB_BVL_Instrument_LINST class removes '_date' from the element name before calling addDateElement(). Basic Date and Month/Year formats call the NDB_Page class addBasicDate() function and the NDB_BVL_Instrument class addMonthYear) function respectively, both of which do not seem to auto append '_date' to the field name. With this change, if a Standard Date format field name does not already end with '_date' , a LorisException is thrown.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Category: Bug
PR or issue that aims to report or fix a bug
Cleanup
PR or issue introducing/requiring at least one clean-up operation
Passed manual tests
PR has been successfully tested by at least one peer
Release: Breaking changes
PR that contains changes that might impact the code or accepted practices of active projects
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Brief summary of changes
This PR fixes the removal of '_date' by only allowing it to happen for Standard Date formats.
Currently, all date elements (standard, basic, and month/year) in linst instruments have their field names redefined as the substring appearing before '_date'. For example, if a date element is called 'enrolment_date_v2', the instrument field name becomes
enrolment
. The issue with this is that on saving the instrument, the save function will try to update a field called 'enrolment' in the instrument table which does not exist.Now, the reason why this functionality existed in the first place is because the Standard Date format requires a field name ending with '_date'. Linst Standard Date formats are created by calling the
NDB_BVL_Instrument
class addDateElement() function which auto appends '_date' to the date element name. In order to avoid '_date' appearing twice, theNDB_BVL_Instrument_LINST class
removes '_date' from the element name before calling addDateElement().Basic Date and Month/Year formats call the NDB_Page class addBasicDate() function and the NDB_BVL_Instrument class addMonthYear) function respectively, both of which do not seem to auto append '_date' to the field name.
In this PR, if a Standard Date format field name does not already end with '_date' , a LorisException is thrown.
Testing instructions (if applicable)
bmi
SQL table. You can run in mysql:'Inspect' the HTML date element on the browser, and notice that the input name is 'completion' instead of 'completion_date'.
4. On this PR branch, repeat the above step and you will get no errors (except for maybe 'Error running scoring algorithm' which is a separate issue I think is unrelated to this PR)
5. On this PR branch still, modify the last line of the bmi.list file to be:
This now changes the date element from a Basic Date format to a Standard Date format. A standard date format date field requires a not_answered '_status' field so run in mysql:
completion_date
and notcompletion_date_date