Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/graphql/graphql_operations_generated.json

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion app/graphql/types/ranked_choice_decision_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ class RankedChoiceDecisionType < Types::BaseObject
field :signup_round, Types::SignupRoundType, null: false do # rubocop:disable GraphQL/ExtractType
description "The signup round in which this decision was made."
end
field :target_run, Types::RunType, description: "The run this ranked choice was attempting to sign up for."
field :updated_at, Types::DateType, null: false do
description "The time this RankedChoiceDecision was last modified."
end
Expand All @@ -41,6 +42,7 @@ class RankedChoiceDecisionType < Types::BaseObject
:signup_ranked_choice,
:signup_round,
:signup,
:signup_request
:signup_request,
:target_run
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ function RankedChoiceSignupDecisionsTable({ signupRoundId }: RankedChoiceSignupD
enableColumnFilter: true,
enableSorting: true,
}),
columnHelper.accessor('signup_ranked_choice.target_run.event.title', {
columnHelper.accessor('target_run.event.title', {
header: 'Event',
id: 'event_title',
enableColumnFilter: true,
Expand Down
4 changes: 2 additions & 2 deletions app/javascript/SignupRoundsAdmin/queries.generated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ export type SignupRoundRankedChoiceDecisionsTableQueryVariables = Types.Exact<{
}>;


export type SignupRoundRankedChoiceDecisionsTableQueryData = { __typename: 'Query', convention: { __typename: 'Convention', id: string, signup_round: { __typename: 'SignupRound', id: string, ranked_choice_decisions_paginated: { __typename: 'RankedChoiceDecisionsPagination', total_pages: number, entries: Array<{ __typename: 'RankedChoiceDecision', id: string, created_at: string, decision: Types.RankedChoiceDecisionValue, reason?: Types.RankedChoiceDecisionReason | null, user_con_profile?: { __typename: 'UserConProfile', id: string, name_without_nickname: string } | null, signup_ranked_choice?: { __typename: 'SignupRankedChoice', id: string, priority: number, requested_bucket_key?: string | null, state: Types.SignupRankedChoiceState, target_run: { __typename: 'Run', id: string, starts_at: string, title_suffix?: string | null, event: { __typename: 'Event', id: string, title?: string | null } } } | null }> } } } };
export type SignupRoundRankedChoiceDecisionsTableQueryData = { __typename: 'Query', convention: { __typename: 'Convention', id: string, signup_round: { __typename: 'SignupRound', id: string, ranked_choice_decisions_paginated: { __typename: 'RankedChoiceDecisionsPagination', total_pages: number, entries: Array<{ __typename: 'RankedChoiceDecision', id: string, created_at: string, decision: Types.RankedChoiceDecisionValue, reason?: Types.RankedChoiceDecisionReason | null, user_con_profile?: { __typename: 'UserConProfile', id: string, name_without_nickname: string } | null, target_run?: { __typename: 'Run', id: string, starts_at: string, title_suffix?: string | null, event: { __typename: 'Event', id: string, title?: string | null } } | null }> } } } };

export const SignupRoundFieldsFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SignupRoundFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"SignupRound"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"maximum_event_signups"}},{"kind":"Field","name":{"kind":"Name","value":"automation_action"}},{"kind":"Field","name":{"kind":"Name","value":"ranked_choice_order"}},{"kind":"Field","name":{"kind":"Name","value":"rerandomize_lottery_numbers"}},{"kind":"Field","name":{"kind":"Name","value":"start"}},{"kind":"Field","name":{"kind":"Name","value":"executed_at"}}]}}]} as unknown as DocumentNode<SignupRoundFieldsFragment, unknown>;
export const SignupRoundsAdminQueryDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"SignupRoundsAdminQuery"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"convention"},"name":{"kind":"Name","value":"conventionByRequestHost"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"signup_rounds"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"FragmentSpread","name":{"kind":"Name","value":"SignupRoundFields"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SignupRoundFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"SignupRound"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"maximum_event_signups"}},{"kind":"Field","name":{"kind":"Name","value":"automation_action"}},{"kind":"Field","name":{"kind":"Name","value":"ranked_choice_order"}},{"kind":"Field","name":{"kind":"Name","value":"rerandomize_lottery_numbers"}},{"kind":"Field","name":{"kind":"Name","value":"start"}},{"kind":"Field","name":{"kind":"Name","value":"executed_at"}}]}}]} as unknown as DocumentNode<SignupRoundsAdminQueryData, SignupRoundsAdminQueryVariables>;
export const SignupRoundRankedChoiceDecisionsTableQueryDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"SignupRoundRankedChoiceDecisionsTableQuery"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"signupRoundId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"page"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"Int"}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"perPage"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"Int"}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"filters"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"RankedChoiceDecisionFiltersInput"}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"sort"}},"type":{"kind":"ListType","type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"SortInput"}}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"convention"},"name":{"kind":"Name","value":"conventionByRequestHost"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"signup_round"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"signupRoundId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"ranked_choice_decisions_paginated"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"page"},"value":{"kind":"Variable","name":{"kind":"Name","value":"page"}}},{"kind":"Argument","name":{"kind":"Name","value":"per_page"},"value":{"kind":"Variable","name":{"kind":"Name","value":"perPage"}}},{"kind":"Argument","name":{"kind":"Name","value":"filters"},"value":{"kind":"Variable","name":{"kind":"Name","value":"filters"}}},{"kind":"Argument","name":{"kind":"Name","value":"sort"},"value":{"kind":"Variable","name":{"kind":"Name","value":"sort"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"total_pages"}},{"kind":"Field","name":{"kind":"Name","value":"entries"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"created_at"}},{"kind":"Field","name":{"kind":"Name","value":"decision"}},{"kind":"Field","name":{"kind":"Name","value":"reason"}},{"kind":"Field","name":{"kind":"Name","value":"user_con_profile"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name_without_nickname"}}]}},{"kind":"Field","name":{"kind":"Name","value":"signup_ranked_choice"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"priority"}},{"kind":"Field","name":{"kind":"Name","value":"requested_bucket_key"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"target_run"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"starts_at"}},{"kind":"Field","name":{"kind":"Name","value":"title_suffix"}},{"kind":"Field","name":{"kind":"Name","value":"event"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"title"}}]}}]}}]}}]}}]}}]}}]}}]}}]} as unknown as DocumentNode<SignupRoundRankedChoiceDecisionsTableQueryData, SignupRoundRankedChoiceDecisionsTableQueryVariables>;
export const SignupRoundRankedChoiceDecisionsTableQueryDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"SignupRoundRankedChoiceDecisionsTableQuery"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"signupRoundId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"page"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"Int"}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"perPage"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"Int"}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"filters"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"RankedChoiceDecisionFiltersInput"}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"sort"}},"type":{"kind":"ListType","type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"SortInput"}}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"convention"},"name":{"kind":"Name","value":"conventionByRequestHost"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"signup_round"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"signupRoundId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"ranked_choice_decisions_paginated"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"page"},"value":{"kind":"Variable","name":{"kind":"Name","value":"page"}}},{"kind":"Argument","name":{"kind":"Name","value":"per_page"},"value":{"kind":"Variable","name":{"kind":"Name","value":"perPage"}}},{"kind":"Argument","name":{"kind":"Name","value":"filters"},"value":{"kind":"Variable","name":{"kind":"Name","value":"filters"}}},{"kind":"Argument","name":{"kind":"Name","value":"sort"},"value":{"kind":"Variable","name":{"kind":"Name","value":"sort"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"total_pages"}},{"kind":"Field","name":{"kind":"Name","value":"entries"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"created_at"}},{"kind":"Field","name":{"kind":"Name","value":"decision"}},{"kind":"Field","name":{"kind":"Name","value":"reason"}},{"kind":"Field","name":{"kind":"Name","value":"user_con_profile"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name_without_nickname"}}]}},{"kind":"Field","name":{"kind":"Name","value":"target_run"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"starts_at"}},{"kind":"Field","name":{"kind":"Name","value":"title_suffix"}},{"kind":"Field","name":{"kind":"Name","value":"event"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"title"}}]}}]}}]}}]}}]}}]}}]}}]} as unknown as DocumentNode<SignupRoundRankedChoiceDecisionsTableQueryData, SignupRoundRankedChoiceDecisionsTableQueryVariables>;
17 changes: 5 additions & 12 deletions app/javascript/SignupRoundsAdmin/queries.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -43,21 +43,14 @@ query SignupRoundRankedChoiceDecisionsTableQuery(
name_without_nickname
}

signup_ranked_choice {
target_run {
id
priority
requested_bucket_key
state
starts_at
title_suffix

target_run {
event {
id
starts_at
title_suffix

event {
id
title
}
title
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions app/javascript/graphqlTypes.generated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5072,6 +5072,8 @@ export type RankedChoiceDecision = {
signup_request?: Maybe<SignupRequest>;
/** The signup round in which this decision was made. */
signup_round: SignupRound;
/** The run this ranked choice was attempting to sign up for. */
target_run?: Maybe<Run>;
/** The time this RankedChoiceDecision was last modified. */
updated_at: Scalars['Date']['output'];
/** The user profile this decision pertains to, if any. */
Expand Down
2 changes: 1 addition & 1 deletion app/models/ranked_choice_decision.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class RankedChoiceDecision < ApplicationRecord
belongs_to :after_signup_ranked_choice, class_name: "SignupRankedChoice", optional: true
belongs_to :signup, optional: true
belongs_to :signup_request, optional: true
has_one :target_run, through: :signup_request
has_one :target_run, through: :signup_ranked_choice
has_one :event, through: :target_run

DECISIONS = Types::RankedChoiceDecisionValueType.values.values.map(&:value).freeze
Expand Down
8 changes: 5 additions & 3 deletions app/policies/ranked_choice_decision_policy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def manage?
end

class Scope < Scope
def resolve
def resolve # rubocop:disable Metrics/MethodLength
return scope.all if site_admin?

decision_scope =
Expand All @@ -41,8 +41,10 @@ def resolve
end

if assumed_identity_from_profile
decision_scope.where(
target_run: Run.where(event: Event.where(convention_id: assumed_identity_from_profile.convention_id))
decision_scope.joins(signup_ranked_choice: :target_run).where(
runs: {
id: Run.where(event: Event.where(convention_id: assumed_identity_from_profile.convention_id)).select(:id)
}
)
else
decision_scope
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def generate_csv_cell(decision)
ilike_column_filter :title, association_name: :event

def generate_csv_cell(decision)
decision.event&.title
decision.event.title
end
end

Expand Down
5 changes: 5 additions & 0 deletions schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -6425,6 +6425,11 @@
"""
signup_round: SignupRound!

"""
The run this ranked choice was attempting to sign up for.
"""
target_run: Run

Check notice on line 6431 in schema.graphql

View workflow job for this annotation

GitHub Actions / GraphQL Inspector

Field 'target_run' was added to object type 'RankedChoiceDecision'

Field 'target_run' was added to object type 'RankedChoiceDecision'

"""
The time this RankedChoiceDecision was last modified.
"""
Expand Down
12 changes: 12 additions & 0 deletions schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -28336,6 +28336,18 @@
"deprecationReason": null,
"args": []
},
{
"name": "target_run",
"description": "The run this ranked choice was attempting to sign up for.",
"type": {
"kind": "OBJECT",
"name": "Run",
"ofType": null
},
"isDeprecated": false,
"deprecationReason": null,
"args": []
},
{
"name": "updated_at",
"description": "The time this RankedChoiceDecision was last modified.",
Expand Down
Loading