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

Commit

Permalink
Show facility address and country on claimed facilities page
Browse files Browse the repository at this point in the history
This additional information helps to identify the facility when there may be
more than one claimed facility with the same name.
  • Loading branch information
jwalgran committed Jun 13, 2019
1 parent bbbe401 commit e9203bf
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 4 deletions.
18 changes: 15 additions & 3 deletions src/app/src/components/ClaimedFacilitiesListTable.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,17 @@ function ClaimedFacilitiesListTable({
<Table>
<TableHead>
<TableRow>
<TableCell style={dashboardClaimsListTableStyles.oarIdColumnStyles}>
<TableCell>
Name
</TableCell>
<TableCell>
OAR ID
</TableCell>
<TableCell>
Facility Name
Address
</TableCell>
<TableCell>
Country
</TableCell>
</TableRow>
</TableHead>
Expand All @@ -56,11 +62,17 @@ function ClaimedFacilitiesListTable({
onClick={makeRowClickHandler(claim.id)}
style={dashboardClaimsListTableStyles.rowStyles}
>
<TableCell>
{claim.facility_name}
</TableCell>
<TableCell>
{claim.oar_id}
</TableCell>
<TableCell>
{claim.facility_name}
{claim.facility_address}
</TableCell>
<TableCell>
{claim.facility_country_name}
</TableCell>
</TableRow>
))
Expand Down
11 changes: 10 additions & 1 deletion src/django/api/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -432,11 +432,14 @@ class FacilityClaimSerializer(ModelSerializer):
oar_id = SerializerMethodField()
contributor_name = SerializerMethodField()
contributor_id = SerializerMethodField()
facility_address = SerializerMethodField()
facility_country_name = SerializerMethodField()

class Meta:
model = FacilityClaim
fields = ('id', 'created_at', 'updated_at', 'contributor_id', 'oar_id',
'contributor_name', 'facility_name', 'status')
'contributor_name', 'facility_name', 'facility_address',
'facility_country_name', 'status')

def get_facility_name(self, claim):
return claim.facility.name
Expand All @@ -450,6 +453,12 @@ def get_contributor_name(self, claim):
def get_contributor_id(self, claim):
return claim.contributor.admin.id

def get_facility_address(self, claim):
return claim.facility.address

def get_facility_country_name(self, claim):
return COUNTRY_NAMES.get(claim.facility.country_code, '')


class FacilityClaimDetailsSerializer(ModelSerializer):
contributor = SerializerMethodField()
Expand Down
2 changes: 2 additions & 0 deletions src/django/api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -631,6 +631,8 @@ def claimed(self, request):
"oar_id": "US2019161ABC123",
"contributor_name": "A Contributor",
"facility_name": "Clothing, Inc.",
"facility_address": "1234 Main St",
"facility_country": "United States",
"status": "APPROVED"
}
]
Expand Down

0 comments on commit e9203bf

Please sign in to comment.