Skip to content
This repository has been archived by the owner on Feb 1, 2024. It is now read-only.

Create product type extended field #1605

Merged
merged 2 commits into from Feb 1, 2022
Merged

Conversation

jwalgran
Copy link
Contributor

@jwalgran jwalgran commented Jan 28, 2022

Overview

Create product type extended fields when product type is submitted via CSV or API

Connects #1586

Demo

Screen Shot 2022-01-28 at 11 08 18 AM

Screen Shot 2022-01-28 at 11 15 17 AM

Testing Instructions

These instruction assume ./scripts/resetdb has been run.

{
  "country": "US",
  "name": "Azavea",
  "address": "990 Spring Garden Street, 5th Floor Philadelphia, PA 19123",
  "product_type": ["Hats", "Shoes", "Gloves"]
}
  • Copy the OAER ID of the created facility from the API response and, In another tab, browse the facility and verify that the extended field value is displayed in the sidebar
  • Back on the API page submit this JSON
{
  "country": "US",
  "name": "Azavea",
  "address": "990 Spring Garden Street, 5th Floor Philadelphia, PA 19123",
  "product_type": {}
}
  • Verify that a 400 is returned with an error message
  • Submit this JSON
[{
  "country": "US",
  "name": "Azavea",
  "address": "990 Spring Garden Street, 5th Floor Philadelphia, PA 19123",
  "product_type": ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31", "32", "33", "34", "35", "36", "37", "38", "39", "40", "41", "42", "43", "44", "45", "46", "47", "48", "49", "50"]
}]
./scripts/manage batch_process --list-id 16 --action parse
./scripts/manage batch_process --list-id 16 --action geocode
./scripts/manage batch_process --list-id 16 --action match
  • Refresh the browser and click the lock to navigate to the facility and verify that the the product types are displayed
  • In a the admin browser session browse http://localhost:8081/admin/api/extendedfield/2/ and verify that the extended field created includes a raw_values key set to an array of values.

Checklist

  • fixup! commits have been squashed
  • CI passes after rebase
  • CHANGELOG.md updated with summary of features or fixes, following Keep a Changelog guidelines

@jwalgran jwalgran marked this pull request as ready for review January 28, 2022 18:34
Copy link
Contributor

@emilyhu0106 emilyhu0106 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I followed all of the steps and thing works nicely! Thank you for the detailed testing instructions.
There is one merge conflict between this branch and develop because of we are working on in parallel. I believe we can just accept both changes.

Adds handling to create `ExtendedField` records for submitted product type
values enforcing the following requirements:

- Submitted values are a pipe-delimited string or an array of strings
- The number of development values must be equal to or less than 50

50 items was chosen by the OAR team as a reasonable upper bound

We want to make use of the `join_group_and_login` in multiple test case
classes so we move it upto the `FacilityAPITestCaseBase`.
@emilyhu0106 emilyhu0106 assigned jwalgran and unassigned emilyhu0106 Feb 1, 2022
@jwalgran
Copy link
Contributor Author

jwalgran commented Feb 1, 2022

Thanks for the review.

@jwalgran jwalgran merged commit 6034c54 into develop Feb 1, 2022
@jwalgran jwalgran deleted the feature/jcw/product-type branch February 1, 2022 19:39
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants