diff --git a/src/client/pages/Country/hooks/useUserRedirect.ts b/src/client/pages/Country/hooks/useUserRedirect.ts index c5a2a57e37..f8158fb912 100644 --- a/src/client/pages/Country/hooks/useUserRedirect.ts +++ b/src/client/pages/Country/hooks/useUserRedirect.ts @@ -31,7 +31,7 @@ export const useUserRedirect = (): void => { } // Redirect non admin users to the cycle page if the cycle is not published when accessing regions - if (Cycles.isPublished(cycle) && !Users.isAdministrator(user) && !Areas.isISOCountry(countryIso)) { + if (!Cycles.isPublished(cycle) && !Users.isAdministrator(user) && !Areas.isISOCountry(countryIso)) { navigate(Routes.Cycle.generatePath({ assessmentName, cycleName })) } }, [assessmentName, countryIso, cycle, cycleName, navigate, user, userRole]) diff --git a/src/client/store/ui/dataExport/hooks/index.ts b/src/client/store/ui/dataExport/hooks/index.ts index 5759996885..0fe9c68a06 100644 --- a/src/client/store/ui/dataExport/hooks/index.ts +++ b/src/client/store/ui/dataExport/hooks/index.ts @@ -31,7 +31,7 @@ export const useDataExportCountries = (): Array => { // initialize data export countries if (Objects.isEmpty(countries)) { let countriesDataExport = countriesAll - if (Cycles.isPublished(cycle) && !Users.isAdministrator(user)) { + if (!Cycles.isPublished(cycle) && !Users.isAdministrator(user)) { countriesDataExport = countriesDataExport.filter((country) => userCountries.includes(country.countryIso)) } if (Areas.isRegion(countryIso)) { diff --git a/src/test/migrations/steps/20240919123658-step-update-cycle-props-published-date-status.ts b/src/test/migrations/steps/20240919123658-step-update-cycle-props-published-date-status.ts index 6eb9649ad2..ca93433d66 100644 --- a/src/test/migrations/steps/20240919123658-step-update-cycle-props-published-date-status.ts +++ b/src/test/migrations/steps/20240919123658-step-update-cycle-props-published-date-status.ts @@ -59,18 +59,12 @@ export default async () => { } await client.query(` - do $$ - begin - if exists ( - select 1 - from information_schema.columns - where table_name='assessment_cycle' and column_name='published' - ) then + do $$ + begin alter table assessment_cycle drop column published, add column props jsonb default '{}'::jsonb not null; - end if; - end $$; + end $$; `) const assessments = await AssessmentController.getAll({})