Skip to content

Commit

Permalink
code review comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
devinleighsmith committed Apr 9, 2024
1 parent db34d61 commit c56cd82
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 28 deletions.
18 changes: 0 additions & 18 deletions source/backend/api/Constants/TakeStatusTypes.cs

This file was deleted.

2 changes: 1 addition & 1 deletion source/backend/api/Services/TakeService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public IEnumerable<PimsTake> UpdateAcquisitionPropertyTakes(long acquisitionFile
{
throw new BusinessRuleViolationException("Retired records are referenced for historical purposes only and cannot be edited or deleted. If the take has been added in error, contact your system administrator to re-open the file, which will allow take deletion.");
}
else if (takes.Any(t => t.TakeStatusTypeCode == TakeStatusTypes.COMPLETE.ToString() && t.CompletionDt == null))
else if (takes.Any(t => t.TakeStatusTypeCode == AcquisitionTakeStatusTypes.COMPLETE.ToString() && t.CompletionDt == null))
{
throw new BusinessRuleViolationException("A completed take must have a completion date.");
}
Expand Down
5 changes: 0 additions & 5 deletions source/frontend/src/constants/takesStatusTypes.ts

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import { SectionField } from '@/components/common/Section/SectionField';
import AreaContainer from '@/components/measurements/AreaContainer';
import { Roles } from '@/constants';
import * as API from '@/constants/API';
import { TakesStatusTypes } from '@/constants/takesStatusTypes';
import useKeycloakWrapper from '@/hooks/useKeycloakWrapper';
import useLookupCodeHelpers from '@/hooks/useLookupCodeHelpers';
import { getDeleteModalProps, useModalContext } from '@/hooks/useModalContext';
Expand Down Expand Up @@ -56,7 +55,10 @@ const TakeSubForm: React.FunctionComponent<ITakeSubFormProps> = ({
const takeStatusTypeCode = getIn(values, withNameSpace(nameSpace, 'takeStatusTypeCode'));

React.useEffect(() => {
if (currentTake.completionDt && currentTake.takeStatusTypeCode !== TakesStatusTypes.COMPLETE) {
if (
currentTake.completionDt &&
currentTake.takeStatusTypeCode !== ApiGen_CodeTypes_AcquisitionTakeStatusTypes.COMPLETE
) {
setFieldValue(withNameSpace(nameSpace, 'completionDt'), '');
}
}, [currentTake.completionDt, currentTake.takeStatusTypeCode, nameSpace, setFieldValue]);
Expand Down Expand Up @@ -130,7 +132,9 @@ const TakeSubForm: React.FunctionComponent<ITakeSubFormProps> = ({
</SectionField>
<SectionField
label="Completion date"
required={currentTake.takeStatusTypeCode === TakesStatusTypes.COMPLETE}
required={
currentTake.takeStatusTypeCode === ApiGen_CodeTypes_AcquisitionTakeStatusTypes.COMPLETE
}
tooltip={`This will be enabled when the file status is set to "Completed"`}
labelWidth="4"
contentWidth="5"
Expand All @@ -139,7 +143,9 @@ const TakeSubForm: React.FunctionComponent<ITakeSubFormProps> = ({
formikProps={formikProps}
field={withNameSpace(nameSpace, 'completionDt')}
maxDate={new Date()}
disabled={currentTake.takeStatusTypeCode !== TakesStatusTypes.COMPLETE}
disabled={
currentTake.takeStatusTypeCode !== ApiGen_CodeTypes_AcquisitionTakeStatusTypes.COMPLETE
}
/>
</SectionField>
<SectionField label="Site contamination" labelWidth="4" contentWidth="5">
Expand Down

0 comments on commit c56cd82

Please sign in to comment.