Skip to content
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

Issue 55: Add custom filter for submission type by list. #69

Merged
merged 2 commits into from
Apr 26, 2024

Conversation

kaladay
Copy link

@kaladay kaladay commented Apr 26, 2024

resolves #55

This borrows heavily on the work resolved for Issue 54 (see commit cbe080b).

Most of the field values Controller end points are under the Submission Controller rather than its own Controller. This introduces complications because the UI is using "FieldValue" and mapping it to a Submission Controller. Getting the list of FieldValues, independent of a Submission, does not belong in the Submission Controller. There are a lot of work-arounds or other unusual design changes here to accommodate this situation. A new FieldValueRepo is added on the UI.

This adds new functionality for selecting all Field Values associated with a given Field Predicate. This is used to select the specific Field Predicate that is hard-coded as submission_type.

It turns out the escape string usage in cbe080bcdc4477bc1f5f8ceeff27abbf0bb94528 is not entirely correct. The string does need to be escaped, but not the % and not the _. Only the slashes.
Change the escapeString() function to handle this use case.

The Submission Type column already exists.
Create a new one called Submission Type (List).
This exposed a problem in the design where the names of the columns are used to generate the array key names and HTML attribute names. The use of ( and ) is not well supported there. Break out the sanitizer used in several places into a single function call and have that function call also handle ( and ). Other cases are not handled and I am leaving those to be handled on an as-needed basis. To avoid conflicts with the existing Submission Type, the new Submission Type (List) is suffixed with List in several places.

The submissionListColumns variable in the processUpdate of the SubmissionListController is being used for both the Manage Filter Columns and the Submission List Columns. This is a problem where the new Submission Type (List) is only a Filter and is not a Column to select. The code had to be re-worked to address this.
I chose the quick and simple approach of making another variable. There may be better ways but this seems good enough at this time.

A recent change introduced setting $dirty on $scope.getSelectedOrganization() but that did not handle the case where $scope.getSelectedOrganization() is undefined or NULL. This broke some unit tests but is now fixed.

Update the CLI tests to generate Submission Types that are not always different. The Submission Type is created outside of the transaction loop to ensure only a small set is created. If there already exists Submission Types then no new ones are created and the existing ones are re-used. This allows for building generated test data on a system with existing data already populated.

This borrows heavily on the work resolved for Issue 54 (see commit cbe080b).

Most of the field values Controller end points are under the Submission Controller rather than its own Controller.
This introduces complications because the UI is using "FieldValue" and mapping it to a Submission Controller.
Getting the list of FieldValues, independent of a Submission, does not belong in the Submission Controller.
There are a lot of work-arounds or other unusual design changes here to accommodate this situation.
A new `FieldValueRepo` is added on the UI.

This adds new functionality for selecting all Field Values associated with a given Field Predicate.
This is used to select the specific Field Predicate that is hard-coded as `submission_type`.

It turns out the escape string usage in `cbe080bcdc4477bc1f5f8ceeff27abbf0bb94528` is not entirely correct.
The string does need to be escaped, but not the `%` and not the `_`.
Only the slashes.
Change the `escapeString()` function to handle this use case.

The **Submission Type** column already exists.
Create a new one called `Submission Type (List)`.
This exposed a problem in the design where the names of the columns are used to generate the array key names and HTML attribute names.
The use of `(` and `)` is not well supported there.
Break out the sanitizer used in several places into a single function call and have that function call also handle `(` and `)`.
Other cases are not handled and I am leaving those to be handled on an as-needed basis.
To avoid conflicts with the existing **Submission Type**, the new **Submission Type (List)** is suffixed with `List` in several places.

The `submissionListColumns` variable in the `processUpdate` of the `SubmissionListController` is being used for both the **Manage Filter Columns** and the **Submission List Columns**.
This is a problem where the new `Submission Type (List)` is only a Filter and is not a Column to select.
The code had to be re-worked to address this.
I chose the quick and simple approach of making another variable.
There may be better ways but this seems good enough at this time.

A recent change introduced setting `$dirty` on `$scope.getSelectedOrganization()` but that did not handle the case where `$scope.getSelectedOrganization()` is undefined or NULL.
This broke some unit tests but is now fixed.

Update the CLI tests to generate Submission Types that are not always different.
The Submission Type is created outside of the transaction loop to ensure only a small set is created.
If there already exists Submission Types then no new ones are created and the existing ones are re-used.
This allows for building generated test data on a system with existing data already populated.
@kaladay kaladay requested a review from jsavell April 26, 2024 15:34
@kaladay kaladay linked an issue Apr 26, 2024 that may be closed by this pull request
…ted to embargo.

This is just a copy and paste mistake.
@kaladay kaladay merged commit fb95ae7 into sprint1-staging Apr 26, 2024
0 of 2 checks passed
@jsavell jsavell mentioned this pull request Apr 30, 2024
@kaladay kaladay deleted the 55-submission_type_filter branch May 31, 2024 14:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add custom filter for submission type by list
2 participants