Skip to content

Commit

Permalink
Fix topic poll create after meeting create (#3026)
Browse files Browse the repository at this point in the history
  • Loading branch information
bastianjoel authored Nov 20, 2023
1 parent 9d64752 commit 66b6859
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 6 deletions.
2 changes: 2 additions & 0 deletions client/src/app/domain/models/users/group.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export class Group extends BaseModel<Group> {
public assignment_poll_ids!: Id[]; // (assignment_poll/entitled_group_ids)[];
public used_as_motion_poll_default_id!: Id; // meeting/motion_poll_default_group_ids;
public used_as_assignment_poll_default_id!: Id; // meeting/assignment_poll_default_group_ids;
public used_as_topic_poll_default_id!: Id; // meeting/topic_poll_default_group_ids;

public get isAdminGroup(): boolean {
return !!this.admin_group_for_meeting_id;
Expand Down Expand Up @@ -58,6 +59,7 @@ export class Group extends BaseModel<Group> {
`write_chat_group_ids`,
`used_as_motion_poll_default_id`,
`used_as_assignment_poll_default_id`,
`used_as_topic_poll_default_id`,
`meeting_id`
];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,12 @@ export const RELATIONS: Relation[] = [
OField: `assignment_poll_default_groups`,
MField: `used_as_assignment_poll_default`
}),
...makeM2O({
OViewModel: ViewMeeting,
MViewModel: ViewGroup,
OField: `topic_poll_default_groups`,
MField: `used_as_topic_poll_default`
}),
...makeM2O({
OViewModel: ViewMeeting,
MViewModel: ViewPointOfOrderCategory,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ export class TopicPollService extends PollService {
public defaultPollMethod: PollMethod;
public defaultPercentBase: PollPercentBase;
public defaultGroupIds: number[];
public defaultPollType: PollType;

public constructor(
organizationSettingsService: OrganizationSettingsService,
Expand All @@ -64,10 +63,6 @@ export class TopicPollService extends PollService {
.get(`poll_default_method`)
.subscribe(method => (this.defaultPollMethod = method ?? PollMethod.Y));

this.meetingSettingsService
.get(`poll_default_type`)
.subscribe(type => (this.defaultPollType = type ?? PollType.Pseudoanonymous));

this.meetingSettingsService.get(`poll_sort_poll_result_by_votes`).subscribe(sort => (this.sortByVote = sort));
}

Expand All @@ -77,7 +72,7 @@ export class TopicPollService extends PollService {
onehundred_percent_base: this.defaultPercentBase,
entitled_group_ids: Object.values(this.defaultGroupIds ?? []),
pollmethod: this.defaultPollMethod,
type: this.defaultPollType,
type: PollType.Pseudoanonymous,
backend: PollBackendDurationType.FAST
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,6 @@ interface IGroupRelations {
polls: ViewPoll[];
used_as_motion_poll_default?: ViewMeeting;
used_as_assignment_poll_default?: ViewMeeting;
used_as_topic_poll_default?: ViewMeeting;
}
export interface ViewGroup extends Group, IGroupRelations, HasMeeting {}
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ interface IMeetingRelations {
motions_default_statute_amendment_workflow: ViewMotionWorkflow;
motion_poll_default_groups: ViewGroup[];
assignment_poll_default_groups: ViewGroup[];
topic_poll_default_groups: ViewGroup[];
poll_default_groups: ViewGroup[];
projectors: ViewProjector[];
all_projections: ViewProjection[];
Expand Down

0 comments on commit 66b6859

Please sign in to comment.