Skip to content

Commit

Permalink
Revert "fix: make program attribute mandatory if TET attribute is man…
Browse files Browse the repository at this point in the history
…datory"

This reverts commit 53b088a.
  • Loading branch information
superskip committed Nov 7, 2023
1 parent aea74a3 commit 7ab03fb
Showing 1 changed file with 1 addition and 15 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// @flow
import { useMemo } from 'react';
import { useOptionSetsForAttributes } from './hooks/useOptionSetsForAttributes';
import { scopeTypes, Section } from '../../../../../metaData';
import { scopeTypes } from '../../../../../metaData';
import { useProgramFromIndexedDB } from '../../../../../utils/cachedDataHooks/useProgramFromIndexedDB';
import { useScopeInfo } from '../../../../../hooks/useScopeInfo';
import { useTrackedEntityTypeCollection } from './hooks/useTrackedEntityTypeCollection';
Expand Down Expand Up @@ -72,20 +72,6 @@ export const useMetadataForRegistrationForm = ({ selectedScopeId }: Props) => {
locale,
});

if (trackedEntityType && enrollment) {
for (const tetAttribute of trackedEntityType.trackedEntityTypeAttributes) {
if (tetAttribute.mandatory) {
const section = enrollment.enrollmentForm.getSection(Section.MAIN_SECTION_ID);
if (section) {
const enrollmentAttribute = section.elements && section.elements.get(tetAttribute.trackedEntityAttributeId);
if (enrollmentAttribute) {
enrollmentAttribute.compulsory = true;
}
}
}
}
}

if (scopeType === scopeTypes.TRACKED_ENTITY_TYPE && trackedEntityTypeCollection && tetId) {
return {
name: trackedEntityTypeCollection.name,
Expand Down

0 comments on commit 7ab03fb

Please sign in to comment.