Skip to content

Commit

Permalink
fix: don't show reservations tab if application has none
Browse files Browse the repository at this point in the history
  • Loading branch information
joonatank committed Dec 18, 2024
1 parent 56e443e commit 15406ce
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 1 deletion.
5 changes: 5 additions & 0 deletions apps/admin-ui/gql/gql-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -551,6 +551,7 @@ export type ApplicationSectionNode = Node & {
application: ApplicationNode;
appliedReservationsPerWeek: Scalars["Int"]["output"];
extUuid: Scalars["UUID"]["output"];
hasReservations: Scalars["Boolean"]["output"];
/** The ID of the object */
id: Scalars["ID"]["output"];
name: Scalars["String"]["output"];
Expand Down Expand Up @@ -5364,6 +5365,7 @@ export type ApplicationSectionCommonFragment = {
};

export type ApplicationSectionUiFragment = {
hasReservations: boolean;
id: string;
pk?: number | null;
name: string;
Expand Down Expand Up @@ -5706,6 +5708,7 @@ export type ApplicationAdminFragment = {
applicationSections?: Array<{
id: string;
allocations?: number | null;
hasReservations: boolean;
pk?: number | null;
name: string;
status?: ApplicationSectionStatusChoice | null;
Expand Down Expand Up @@ -7219,6 +7222,7 @@ export type ApplicationAdminQuery = {
applicationSections?: Array<{
id: string;
allocations?: number | null;
hasReservations: boolean;
pk?: number | null;
name: string;
status?: ApplicationSectionStatusChoice | null;
Expand Down Expand Up @@ -8743,6 +8747,7 @@ export const ApplicantFragmentDoc = gql`
export const ApplicationSectionUiFragmentDoc = gql`
fragment ApplicationSectionUI on ApplicationSectionNode {
...ApplicationSectionCommon
hasReservations
suitableTimeRanges {
id
pk
Expand Down
6 changes: 6 additions & 0 deletions apps/ui/gql/gql-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -551,6 +551,7 @@ export type ApplicationSectionNode = Node & {
application: ApplicationNode;
appliedReservationsPerWeek: Scalars["Int"]["output"];
extUuid: Scalars["UUID"]["output"];
hasReservations: Scalars["Boolean"]["output"];
/** The ID of the object */
id: Scalars["ID"]["output"];
name: Scalars["String"]["output"];
Expand Down Expand Up @@ -5687,6 +5688,7 @@ export type ApplicationCommonFragment = {
}>;
};
applicationSections?: Array<{
hasReservations: boolean;
id: string;
pk?: number | null;
name: string;
Expand Down Expand Up @@ -5851,6 +5853,7 @@ export type ApplicationQuery = {
}>;
};
applicationSections?: Array<{
hasReservations: boolean;
id: string;
pk?: number | null;
name: string;
Expand Down Expand Up @@ -7502,6 +7505,7 @@ export type ApplicationSectionCommonFragment = {
};

export type ApplicationSectionUiFragment = {
hasReservations: boolean;
id: string;
pk?: number | null;
name: string;
Expand Down Expand Up @@ -7944,6 +7948,7 @@ export type ApplicationViewQuery = {
}>;
};
applicationSections?: Array<{
hasReservations: boolean;
id: string;
pk?: number | null;
name: string;
Expand Down Expand Up @@ -8417,6 +8422,7 @@ export const ApplicationSectionCommonFragmentDoc = gql`
export const ApplicationSectionUiFragmentDoc = gql`
fragment ApplicationSectionUI on ApplicationSectionNode {
...ApplicationSectionCommon
hasReservations
suitableTimeRanges {
id
pk
Expand Down
3 changes: 2 additions & 1 deletion apps/ui/pages/applications/[id]/view/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@ function View({ application, tos }: PropsNarrowed): JSX.Element {
const { sentDate } = application.applicationRound;
const handledDate = sentDate ? new Date(sentDate) : new Date();
const showReservations =
application.status === ApplicationStatusChoice.ResultsSent;
application.status === ApplicationStatusChoice.ResultsSent &&
application.applicationSections?.some((section) => section.hasReservations);

return (
<>
Expand Down
3 changes: 3 additions & 0 deletions packages/common/gql/gql-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -551,6 +551,7 @@ export type ApplicationSectionNode = Node & {
application: ApplicationNode;
appliedReservationsPerWeek: Scalars["Int"]["output"];
extUuid: Scalars["UUID"]["output"];
hasReservations: Scalars["Boolean"]["output"];
/** The ID of the object */
id: Scalars["ID"]["output"];
name: Scalars["String"]["output"];
Expand Down Expand Up @@ -5364,6 +5365,7 @@ export type ApplicationSectionCommonFragment = {
};

export type ApplicationSectionUiFragment = {
hasReservations: boolean;
id: string;
pk?: number | null;
name: string;
Expand Down Expand Up @@ -5643,6 +5645,7 @@ export const ApplicationSectionCommonFragmentDoc = gql`
export const ApplicationSectionUiFragmentDoc = gql`
fragment ApplicationSectionUI on ApplicationSectionNode {
...ApplicationSectionCommon
hasReservations
suitableTimeRanges {
id
pk
Expand Down
1 change: 1 addition & 0 deletions packages/common/src/queries/application.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ export const APPLICATION_SECTION_UI_FRAGMENT = gql`
${APPLICATION_SECTION_COMMON_FRAGMENT}
fragment ApplicationSectionUI on ApplicationSectionNode {
...ApplicationSectionCommon
hasReservations
suitableTimeRanges {
id
pk
Expand Down
1 change: 1 addition & 0 deletions tilavaraus.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -582,6 +582,7 @@ type ApplicationSectionNode implements Node {
application: ApplicationNode!
appliedReservationsPerWeek: Int!
extUuid: UUID!
hasReservations: Boolean!
"""
The ID of the object
"""
Expand Down

0 comments on commit 15406ce

Please sign in to comment.