Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion doc/release/RELEASE-NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html

### Bugfix
* Removed the unnecessary duplicate assignment of the `origin_source` field for `Contributor`, `ExtendedField`, `Facility`, `FacilityActivityReport`, `FacilityAlias`, `FacilityClaim`, `FacilityList`, `FacilityListItem`, `FacilityMatch`, `Source`, `FacilityLocation`, and `User` via the custom `default_origin_source` Django management command — and removed the command itself. The `origin_source` field will be set by Django fixtures when deploying the local environment via the `start_local_dev` script and during test runs, which include executing the `start_code_quality_dev` bash script. For models like `FacilityListItem`, `ExtendedField`, and others, it will also be set during list processing triggered by the `reset_database` custom Django management command in the `start_local_dev` and `start_code_quality_dev` bash scripts.
* [OSDEV-2032](https://opensupplyhub.atlassian.net/browse/OSDEV-2032) - Fixed the incorrect indexing of the location type in the production locations OpenSearch index. Previously, it was incorrectly taking the processing type value as the location type — using the fourth item in the `matched_values` array instead of the third, which contains the location type. Also, updated the Logstash filters for both processing type and location type to return only unique values and write them to the production locations OpenSearch index.
* [OSDEV-2032](https://opensupplyhub.atlassian.net/browse/OSDEV-2032) - The following bugs have been fixed as part of this ticket:
* Fixed the incorrect indexing of the location type in the production locations OpenSearch index. Previously, it was incorrectly taking the processing type value as the location type — using the fourth item in the `matched_values` array instead of the third, which contains the location type. Also, updated the Logstash filters for both processing type and location type to return only unique values and write them to the production locations OpenSearch index.
* Adjusted the post-submit popup. Instead of displaying the cleaned and transformed data from ContriCleaner, we now show only the raw input submitted by the usered

### What's new
* [OSDEV-2023](https://opensupplyhub.atlassian.net/browse/OSDEV-2023) - The `Recruitment Agency` has been added to facility type and processing type. So a user can filter production locations on the `/facilities` page, can add this type on the `/contribute/single-location/info/` and `/claimed/:id/` pages.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,39 +52,22 @@ describe('ProductionLocationDialog', () => {
raw_json: {
name: 'Production Location Name',
address: '1234 Production Location St, City, State, 12345',
},
fields: {
product_type: [
"Shirts",
"Pants"
],
facility_type: {
raw_values: [
"Printing, Product Dyeing and Laundering"
],
processed_values: [
"Product Dyeing and Laundering",
"Printing"
]
},
processing_type: {
raw_values: [
"Assembly",
"Printing"
],
processed_values: [
"Assembly",
"Printing"
]
},
facility_type: [
"Printing, Product Dyeing and Laundering"
],
processing_type: [
"Assembly",
"Printing"
],
number_of_workers: {
min: 35,
max: 60
},
parent_company: [
"ParentCompany1",
"ParentCompany2"
],
parent_company: "ParentCompany1, ParentCompany2",
country: "BD"
}
}
Expand Down Expand Up @@ -255,8 +238,6 @@ describe('ProductionLocationDialog tooltip messages for PENDING, CLAIMED and UNC
raw_json: {
name: 'Production Location Name',
address: '1234 Production Location St, City, State, 12345',
},
fields: {
country: "BD"
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { useEffect, useMemo, useState } from 'react';
import { number, object, string } from 'prop-types';
import { withStyles, withTheme } from '@material-ui/core/styles';
import { useHistory } from 'react-router-dom';
import { assign, isArray, isEmpty, pickBy, round, size } from 'lodash';
import { isArray, isEmpty, pickBy, round, size } from 'lodash';
import Button from '@material-ui/core/Button';
import Chip from '@material-ui/core/Chip';
import Typography from '@material-ui/core/Typography';
Expand Down Expand Up @@ -135,13 +135,10 @@ const ProductionLocationDialog = ({
raw_json: {
name: productionLocationName = '',
address = '',
sector = '',
...additionalInformationFields
} = {},
fields,
} = data;

const additionalInformationFields = assign({}, fields, { sector });

const isValidValue = value => {
if (isArray(value)) return value.length > 0;
if (value && typeof value === 'object') return !isEmpty(value);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ const ProductionLocationDialogFields = ({
'min' in value && Object.keys(value).length === 1;
const hasMinMax = value =>
value?.min !== undefined && value?.max !== undefined;
const hasProcessedValues = value =>
isArray(value.processed_values) && value.processed_values.length > 0;

const renderArray = value => {
if (!value || value.length === 0) return null;
Expand All @@ -45,9 +43,6 @@ const ProductionLocationDialogFields = ({
if (hasMinMax(value)) {
return `${value.min.toLocaleString()} - ${value.max.toLocaleString()}`;
}
if (hasProcessedValues(value)) {
return renderArray(value.processed_values);
}
return JSON.stringify(value, (_, v) =>
typeof v === 'string' ? v.replace(/</g, '&lt;') : v,
);
Expand Down