Skip to content

Commit

Permalink
POLIO-1252: remove "reason" key from front-end
Browse files Browse the repository at this point in the history
  • Loading branch information
quang-le committed Dec 23, 2024
1 parent c38404d commit d4c21b8
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 13 deletions.
1 change: 0 additions & 1 deletion plugins/polio/api/shared_serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ class Meta:
round: Field = serializers.PrimaryKeyRelatedField(read_only=True, many=False)
reason_for_delay = ReasonForDelayFieldSerializer()


def validate(self, data):
if data.get("reason_for_delay", None) is None:
raise serializers.ValidationError("No reason provided")
Expand Down
4 changes: 1 addition & 3 deletions plugins/polio/js/src/constants/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import {
Nullable,
} from '../../../../../hat/assets/js/apps/Iaso/types/utils';
import { Profile } from '../../../../../hat/assets/js/apps/Iaso/utils/usersUtils';
import { ReasonForDelay } from '../domains/Campaigns/Rounds/ReasonForDelayModal/hooks/reasons';
import { SubActivityFormValues } from '../domains/Campaigns/SubActivities/types';

export type FormatForNFMArgs<T> = {
Expand Down Expand Up @@ -252,15 +251,14 @@ export type RoundDateHistoryEntry = {
previous_ended_at: string; // DATE
started_at: string; // DATE
ended_at: string; // DATE
reason?: ReasonForDelay;
reason_for_delay: number; // an id
user: { first_name: string; last_name: string; username: string };
created_at: string; // DATE
};

export type Round = {
id: number;
vaccine_names_extended:string;
vaccine_names_extended: string;
started_at: Nullable<string>;
ended_at: Nullable<string>;
mop_up_started_at: Nullable<string>; // date
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@ const ReasonForDelayModal: FunctionComponent<Props> = ({
const { formatMessage } = useSafeIntl();
const { handleSubmit, resetForm } = useFormikContext();
const { locale: activeLocale } = useLocale();
const { data: reasonsForDelayOptions } =
useReasonsDelayOptions(activeLocale);
const { data: reasonsForDelayOptions } = useReasonsDelayOptions(
activeLocale as 'fr' | 'en',
);
return (
<ConfirmCancelModal
id="reasonForDelay-Modal"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,3 @@ export const useReasonsDelayOptions = (
},
});
};

Original file line number Diff line number Diff line change
Expand Up @@ -45,18 +45,14 @@ export const RoundDates: FunctionComponent<Props> = ({
initialValues?.rounds?.find(round => round.number === roundNumber)
?.ended_at,
);
const save = (
{ startDate, endDate, reason, reason_for_delay },
helpers,
) => {
const save = ({ startDate, endDate, reason_for_delay }, helpers) => {
setParentFieldValue(`rounds[${roundIndex}]`, {
...rounds[roundIndex],
started_at: startDate,
ended_at: endDate,
datelogs: [
...(parentFieldValue?.datelogs ?? []),
{
reason,
reason_for_delay,
previous_started_at: currentStartDate,
previous_ended_at: currentEndDate,
Expand All @@ -74,7 +70,6 @@ export const RoundDates: FunctionComponent<Props> = ({
initialValues: {
startDate: currentStartDate,
endDate: currentEndDate,
reason: null,
reason_for_delay: null,
},
enableReinitialize: true,
Expand Down

0 comments on commit d4c21b8

Please sign in to comment.