Skip to content

Commit

Permalink
Fix typo in user redirect (#3957)
Browse files Browse the repository at this point in the history
* Fix typo in user redirect

* Fix migration step for assessment_cycle
  • Loading branch information
sorja authored Sep 24, 2024
1 parent 5862af7 commit 5e92dde
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/client/pages/Country/hooks/useUserRedirect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand Down
2 changes: 1 addition & 1 deletion src/client/store/ui/dataExport/hooks/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export const useDataExportCountries = (): Array<Country> => {
// 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)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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({})
Expand Down

0 comments on commit 5e92dde

Please sign in to comment.