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

The parent company link on the facility claim review page links to the wrong contributor #729

Closed
jwalgran opened this issue Aug 13, 2019 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@jwalgran
Copy link
Contributor

Overview

The parent company link on the facility claim review page links to the wrong contributor.

Expected Behavior

Clicking the parent company link on the facility claim review page navigates to the correct contributor page.

Actual Behavior

Clicking the parent company link on the facility claim review page navigates to the correct contributor page. The wrong ID is being used to build the link URL.

Steps to Reproduce

This assumes the fixture data has been loaded

  • Use shell_plus to create a user account without a related contributor. This ensures the ID sequences between the two model types are out of sync.
>>> u = User(email='test@example.com')
>>> u.set_password('testing123')
>>> u.save()
  • Register and confirm a new account.
  • Log in with that account and open a facility claim. Set the parent company to the newly created contributor associated with the newly registered account
  • Log in as c1@example.com and browse http://localhost:6543/dashboard/claims
  • Open the new claim and verify that the parent company link goes to the wrong page.

Additional context

We show the link correctly on the facility details page when there is an approved claim.

@jwalgran jwalgran added the bug Something isn't working label Aug 13, 2019
@rajadain rajadain added the + label Sep 5, 2019
@rajadain rajadain self-assigned this Sep 5, 2019
@rajadain
Copy link
Contributor

rajadain commented Sep 5, 2019

After following the steps to reproduce this, and viewing the created claim, I see this snippet retrieved from the /api/facility-claims/1 endpoint:

{
  "contributor": {
    "id": 102,
    "name": "TT",
    "description": "TT",
    "website": "",
    "contributor_type": "Civil Society Organization",
    "other_contributor_type": "",
    "facility_lists": [],
    "is_verified": false
  },
  "facility_parent_company": {
    "id": 100,
    "name": "TT"
  },
}

The facility_parent_company.id field is used to populate the Facility Parent Company link. Upon clicking the link, the page the user is taken to fetches its data from the /user-profile/100 endpoint, which fetches the user's data:

https://github.com/open-apparel-registry/open-apparel-registry/blob/df05229571713239feb58a96cd6cd9a118921980/src/django/api/views.py#L214-L223

If, in the claim detail view, the user instead clicks the Claim Contributor link, they are taken to the same profile page, but for id 102 corresponding to the user.


The fundamental issue seems to be that there is no detail page for Facility Parent Company entities, as both Claim Contributors and Facility Parent Company links open the same page. A solution would be to 1️⃣ make a new page for Facility Parent Companies, rather than reusing the Claim Contributors profile page.

A simpler, more temporary alternative could be to 2️⃣ make both links point to the Claim Contributor page, which has the correct details.

An even simpler alternative may be to 3️⃣ remove the link from the Facility Parent Company item, as there is no further information available about it that isn't already in the Claim Contributors page.

Which one should I go with?

@kellyi kellyi removed the + label Sep 5, 2019
@kellyi
Copy link
Contributor

kellyi commented Sep 5, 2019

I think we want to go with option 2 here; I believe that was the originally intended functionality for this feature.

@jwalgran
Copy link
Contributor Author

jwalgran commented Sep 5, 2019

Yes, option 2. We want to show the same link that is on the public facing facility details page.

rajadain added a commit that referenced this issue Sep 10, 2019
Correct Facility Parent Company link

Connects #729
@kellyi kellyi closed this as completed Sep 19, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants