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

Update field handling #1630

Merged
merged 3 commits into from
Feb 8, 2022
Merged

Update field handling #1630

merged 3 commits into from
Feb 8, 2022

Conversation

TaiWilkin
Copy link
Contributor

@TaiWilkin TaiWilkin commented Feb 7, 2022

Overview

Renames ExtendedField.verified to ExtendedField.is_verified to be
consistent with Contributor.is_verified.

Considers Contributor.is_verified in addition to
ExtendedField.is_verified, via sorting by count of trust flags. Assigns
one trust flag if the contributor is verified and one trust flag if
the field is verified, resulting in 0, 1, or 2 possible trust flags.

Prioritizes claimed fields ahead of most frequent value fields when
sorting.

Includes the other_names and other_addresses
information with the extended_fields when serializing, to allow proper
server-side sorting and inclusion of contributor data.

Prioritizes the name from an active/verified facility claim over the
default facility object's name when serializing the Facility.name,
(unless it is in embed mode and prefer_contributor_name is active, in
which case prefers the contributor name).

Adjusts the created_from to hide other contributor information in embed
mode.

Connects #1570

Demo

Screen Shot 2022-02-07 at 2 06 10 PM

Notes

We originally planned to overwrite the facility address and location with claim information as well as the facility name. However, while we record name and address for claims, we don’t have a location/geolocation for claims. This means that a) it’s not currently possible to show claim location for a facility, and b) if we use the claim address but the default location, we could easily end up in a situation where the address says we’re at location X,Y but the geolocation / map says we’re at location Z, A. Geolocating claim addresses is out of scope at this time, so we have prioritized the claim name only for the time being.

Testing Instructions

  • Set http://localhost:8081/admin/api/contributor/2/change/ to be verified and have Deluxe embed permissions
  • Set http://localhost:8081/admin/api/contributor/3/change/ to have Deluxe embed permissions
  • Login as c2@example.com
  • Contribute oar-extended-fields.csv and run ./tools/batch_process 16
    • Note that the extended fields that have been created all have 1 verified flag
  • Login as c3@example.com
  • Contribute oar-extended-fields-2.csv and run ./tools/batch_process 17
  • View the submitted facilities by following the links on http://localhost:6543/lists/17
  • Because the submitted name was the same each time, there will be no ‘other name’ fields. The secondary text should list Service Provider A as the contributor.
  • Because the submitted name was the same each time, the will be no ‘other address’ fields. The secondary text should list Service Provider A as the contributor.
  • The extended fields should each show the result from Service Provider A first.
  • Login as c3@example.com and visit http://localhost:6543/settings under the embed tab. Update the height and width to view the preview.
  • The extended fields shown should be from Factory A. There should be no secondary (contributor) text shown.
  • Login as c4@example.com and claim Hats Are Us.
  • As c1@example.com go to http://localhost:6543/dashboard/claims/1 and approve the claim
  • As c4@example.com navigate to http://localhost:6543/claimed/1/ and set the Facility name to ‘Hats, Hats, Hats’, the address to ‘141 Simpson Ave Ardmore PA 19003’, and Number of Workers to 999.
  • View Hats Are Us. It should now have ‘Hats, Hats, Hats’ listed as the name and show that name was submitted by Brand A.
  • The address should still show ’140 Simpson Ave’
  • The number of workers should be (in order) 1000, 999, 2000.
  • Navigate to http://localhost:8081/admin/api/contributor/2/change/ and mark them as not verified.
  • Refresh Hats Are Us. The number of workers order should now be 999, 2000, and 1000.
  • Login as c2@example.com and view the embedded map again.
  • The name in both the list and details should be ‘Hats, Hats, Hats’. The number of workers should be 1000.
  • Select ‘use my facility name’. The name in the list and details should be ‘Hats Are Us'.

Checklist

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

Renames ExtendedField.verified to ExtendedField.is_verified to be
consistent with Contributor.is_verified.
Considers Contributor.is_verified in addition to
ExtendedField.is_verified, via sorting by count of trust flags. Assigns
one trust flag if the contributor is verified and one trust flag if
the field is verified, resulting in 0, 1, or 2 possible trust flags.

Prioritizes `claimed` fields ahead of `most frequent value` fields when
sorting.
@TaiWilkin TaiWilkin assigned jwalgran and caseycesari and unassigned jwalgran Feb 7, 2022
@TaiWilkin TaiWilkin requested review from caseycesari and removed request for jwalgran February 8, 2022 15:49
Copy link
Contributor

@caseycesari caseycesari left a comment

Choose a reason for hiding this comment

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

Followed the instructions and everything worked exactly as described.

];
}
return [defaultAddressField[0], otherAddressFields];
}, [data]);
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice implementation

@caseycesari caseycesari assigned TaiWilkin and unassigned caseycesari Feb 8, 2022
Includes the other_names and other_addresses
information with the extended_fields when serializing, to allow proper
server-side sorting and inclusion of contributor data.

Prioritizes the name from an active/verified facility claim over the
default facility object's name when serializing the Facility.name,
(unless it is in embed mode and prefer_contributor_name is active, in
which case prefers the contributor name).

Adjusts the created_from to hide other contributor information in embed
mode.
@TaiWilkin
Copy link
Contributor Author

Thank you for reviewing!

@TaiWilkin TaiWilkin merged commit a3a2b41 into develop Feb 8, 2022
@TaiWilkin TaiWilkin deleted the tw/sort-extended-fields branch February 8, 2022 18:14
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.

3 participants