diff --git a/apps/ui/modules/queries/reservationUnit.tsx b/apps/ui/modules/queries/reservationUnit.tsx index 19fa60fa4d..74f18a6b33 100644 --- a/apps/ui/modules/queries/reservationUnit.tsx +++ b/apps/ui/modules/queries/reservationUnit.tsx @@ -53,6 +53,7 @@ const RESERVATION_UNIT_PAGE_FRAGMENT = gql` minReservationDuration maxReservationDuration maxReservationsPerUser + numActiveUserReservations reservationsMinDaysBefore reservationsMaxDaysBefore requireReservationHandling diff --git a/apps/ui/pages/reservation-unit/[id].tsx b/apps/ui/pages/reservation-unit/[id].tsx index ab592965c0..fc9965e0d3 100644 --- a/apps/ui/pages/reservation-unit/[id].tsx +++ b/apps/ui/pages/reservation-unit/[id].tsx @@ -610,10 +610,14 @@ const ReservationUnit = ({ const isReservationQuotaReached = useMemo(() => { return ( reservationUnit?.maxReservationsPerUser != null && - userReservations?.length != null && - userReservations?.length >= reservationUnit?.maxReservationsPerUser + reservationUnit?.numActiveUserReservations != null && + reservationUnit?.numActiveUserReservations >= + reservationUnit?.maxReservationsPerUser ); - }, [reservationUnit?.maxReservationsPerUser, userReservations]); + }, [ + reservationUnit?.maxReservationsPerUser, + reservationUnit?.numActiveUserReservations, + ]); const shouldDisplayApplicationRoundTimeSlots = !!activeApplicationRounds?.length; diff --git a/packages/common/types/gql-types.ts b/packages/common/types/gql-types.ts index 0f6e4d55a2..fccb0b02be 100644 --- a/packages/common/types/gql-types.ts +++ b/packages/common/types/gql-types.ts @@ -917,59 +917,6 @@ export enum CustomerTypeChoice { Nonprofit = "NONPROFIT", } -/** Debugging information for the current query. */ -export type DjangoDebug = { - __typename?: "DjangoDebug"; - /** Raise exceptions for this API query. */ - exceptions?: Maybe>>; - /** Executed SQL queries for this API query. */ - sql?: Maybe>>; -}; - -/** Represents a single exception raised. */ -export type DjangoDebugException = { - __typename?: "DjangoDebugException"; - /** The class of the exception */ - excType: Scalars["String"]["output"]; - /** The message of the exception */ - message: Scalars["String"]["output"]; - /** The stack trace */ - stack: Scalars["String"]["output"]; -}; - -/** Represents a single database query made to a Django managed DB. */ -export type DjangoDebugSql = { - __typename?: "DjangoDebugSQL"; - /** The Django database alias (e.g. 'default'). */ - alias: Scalars["String"]["output"]; - /** Duration of this database query in seconds. */ - duration: Scalars["Float"]["output"]; - /** Postgres connection encoding if available. */ - encoding?: Maybe; - /** Whether this database query was a SELECT. */ - isSelect: Scalars["Boolean"]["output"]; - /** Whether this database query took more than 10 seconds. */ - isSlow: Scalars["Boolean"]["output"]; - /** Postgres isolation level if available. */ - isoLevel?: Maybe; - /** JSON encoded database query parameters. */ - params: Scalars["String"]["output"]; - /** The raw SQL of this query, without params. */ - rawSql: Scalars["String"]["output"]; - /** The actual SQL sent to this database. */ - sql?: Maybe; - /** Start time of this database query. */ - startTime: Scalars["Float"]["output"]; - /** Stop time of this database query. */ - stopTime: Scalars["Float"]["output"]; - /** Postgres transaction ID if available. */ - transId?: Maybe; - /** Postgres transaction status if available. */ - transStatus?: Maybe; - /** The type of database being used (e.g. postrgesql, mysql, sqlite). */ - vendor: Scalars["String"]["output"]; -}; - export type EquipmentCategoryCreateMutationInput = { name: Scalars["String"]["input"]; nameEn?: InputMaybe; @@ -1942,7 +1889,6 @@ export enum QualifierOrderingChoices { export type Query = { __typename?: "Query"; - _debug?: Maybe; /** * Return all allocations that affect allocations for given reservation unit * (through space hierarchy or common resource) during the given time period. diff --git a/tilavaraus.graphql b/tilavaraus.graphql index d1e965ecdb..4c82463fed 100644 --- a/tilavaraus.graphql +++ b/tilavaraus.graphql @@ -866,72 +866,6 @@ scalar DateTime """The `Decimal` scalar type represents a python Decimal.""" scalar Decimal -"""Debugging information for the current query.""" -type DjangoDebug { - """Executed SQL queries for this API query.""" - sql: [DjangoDebugSQL] - - """Raise exceptions for this API query.""" - exceptions: [DjangoDebugException] -} - -"""Represents a single exception raised.""" -type DjangoDebugException { - """The class of the exception""" - excType: String! - - """The message of the exception""" - message: String! - - """The stack trace""" - stack: String! -} - -"""Represents a single database query made to a Django managed DB.""" -type DjangoDebugSQL { - """The type of database being used (e.g. postrgesql, mysql, sqlite).""" - vendor: String! - - """The Django database alias (e.g. 'default').""" - alias: String! - - """The actual SQL sent to this database.""" - sql: String - - """Duration of this database query in seconds.""" - duration: Float! - - """The raw SQL of this query, without params.""" - rawSql: String! - - """JSON encoded database query parameters.""" - params: String! - - """Start time of this database query.""" - startTime: Float! - - """Stop time of this database query.""" - stopTime: Float! - - """Whether this database query took more than 10 seconds.""" - isSlow: Boolean! - - """Whether this database query was a SELECT.""" - isSelect: Boolean! - - """Postgres transaction ID if available.""" - transId: String - - """Postgres transaction status if available.""" - transStatus: String - - """Postgres isolation level if available.""" - isoLevel: String - - """Postgres connection encoding if available.""" - encoding: String -} - """Represents a DurationField value as an integer in seconds.""" scalar Duration @@ -2278,7 +2212,6 @@ type Query { orderBy: [BannerNotificationOrderingChoices] ): BannerNotificationNodeConnection serviceSectors(first: Int, last: Int, offset: Int, after: String, before: String): ServiceSectorNodeConnection - _debug: DjangoDebug } input RecurringReservationCreateMutationInput {