Skip to content

Commit

Permalink
fix: CE-875 ERS filter for dumping broken
Browse files Browse the repository at this point in the history
  • Loading branch information
Scarlett-Truong committed Jul 11, 2024
1 parent d571a49 commit d251d64
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 18 deletions.
5 changes: 5 additions & 0 deletions backend/db/test-only-migrations/V23.0.0__CE-875.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
update complaint
set
geo_organization_unit_code = 'QUEENCHA'
where
geo_organization_unit_code = 'DJNG';
4 changes: 4 additions & 0 deletions backend/src/middleware/maps/automapper-entity-to-dto-maps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ const cosGeoOrgUnitToOrganizationDtoMap = (mapper: Mapper) => {
(destination) => destination.area,
mapFrom((source) => source.area_code),
),
forMember(
(destination) => destination.areaName,
mapFrom((source) => source.area_name),
),
forMember(
(destination) => destination.officeLocation,
mapFrom((source) => source.office_location_code),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ type Props = {
};

export const AllegationComplaintListItem: FC<Props> = ({ type, complaint }) => {
const areaCodes = useAppSelector(selectCodeTable(CODE_TABLE_TYPES.AREA_CODES));
const statusCodes = useAppSelector(selectCodeTable(CODE_TABLE_TYPES.COMPLAINT_STATUS));
const violationCodes = useAppSelector(selectCodeTable(CODE_TABLE_TYPES.VIOLATIONS));

Expand All @@ -35,14 +34,9 @@ export const AllegationComplaintListItem: FC<Props> = ({ type, complaint }) => {
locationDetail,
locationSummary,
delegates,
organization: { area: locationCode, zone },
organization: { areaName: location, zone },
} = complaint;

const getLocationName = (input: string): string => {
const code = areaCodes.find((item) => item.area === input);
return code.areaName;
};

const getStatusDescription = (input: string): string => {
const code = statusCodes.find((item) => item.complaintStatus === input);
return code.longDescription;
Expand Down Expand Up @@ -88,8 +82,6 @@ export const AllegationComplaintListItem: FC<Props> = ({ type, complaint }) => {
const reportedOnDateTime = formatDateTime(reportedOn.toString());
const updatedOnDateTime = formatDateTime(updatedOn.toString());

const location = getLocationName(locationCode);

const statusButtonClass = `badge ${applyStatusClass(status)}`;

const inProgressFlag = isInProgress ? "In Progress" : "";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ type Props = {
};

export const WildlifeComplaintListItem: FC<Props> = ({ type, complaint }) => {
const areaCodes = useAppSelector(selectCodeTable(CODE_TABLE_TYPES.AREA_CODES));
const statusCodes = useAppSelector(selectCodeTable(CODE_TABLE_TYPES.COMPLAINT_STATUS));
const natureOfComplaints = useAppSelector(selectCodeTable(CODE_TABLE_TYPES.NATURE_OF_COMPLAINT));
const speciesCodes = useAppSelector(selectCodeTable(CODE_TABLE_TYPES.SPECIES));
Expand All @@ -35,14 +34,9 @@ export const WildlifeComplaintListItem: FC<Props> = ({ type, complaint }) => {
locationDetail,
locationSummary,
delegates,
organization: { area: locationCode, zone },
organization: { areaName: location, zone },
} = complaint;

const getLocationName = (input: string): string => {
const code = areaCodes.find((item) => item.area === input);
return code.areaName;
};

const getStatusDescription = (input: string): string => {
const code = statusCodes.find((item) => item.complaintStatus === input);
return code.longDescription;
Expand Down Expand Up @@ -93,8 +87,6 @@ export const WildlifeComplaintListItem: FC<Props> = ({ type, complaint }) => {
const natureCode = getNatureOfComplaint(natureOfComplaint);
const species = getSpecies(speciesCode);

const location = getLocationName(locationCode);

const statusButtonClass = `badge ${applyStatusClass(status)}`;

const toggleExpand = () => {
Expand Down
1 change: 1 addition & 0 deletions frontend/src/app/types/app/complaints/complaint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export interface Complaint {
updatedBy: string;
organization: {
area: string;
areaName?: string;
zone: string;
region: string;
officeLocation?: string;
Expand Down

0 comments on commit d251d64

Please sign in to comment.