mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-05-23 20:07:35 -05:00
* Initial * Saves preferences * Include TW * mapModePreferencesToModeList * mapPoolFromPreferences initial * Preference to map pool * Adjust seed * q.looking tests * adds about created map preferences to memento in the correct spot (two preferrers) * Failing test about modes * Mode preferences to memento * Remove old Plus Voting code * Fix seeding * find match by id via kysely * View map memento * Fix up map list generation logic * Mode memento info * Future match modes * Add TODO * Migration number * Migrate test DB * Remove old map pool code * createGroupFromPrevious new * Settings styling * VC to settings * Weapon pool * Add TODOs * Progress * Adjust mode exclusion policy * Progress * Progress * Progress * Notes in progress * Note feedback after submit * Textarea styling * Unskip tests * Note sorting failing test * Private note in Q * Ownerpicksmaps later * New bottom section * Mobile layout initial * Add basic match meta * Tabs initial * Sticky tab * Unseen messages in match page * Front page i18n * Settings i18n * Looking 18n * Chat i18n * Progress * Tranfer weapon pools script * Sticky on match page * Match page translations * i18n - tiers page * Preparing page i18n * Icon * Show add note right after report
37 lines
868 B
TypeScript
37 lines
868 B
TypeScript
import type { GroupMember } from "~/db/types";
|
|
import type { LookingGroup } from "../q-types";
|
|
|
|
// logic is that team who is bigger decides the settings
|
|
// but if groups are the same size then the one who liked
|
|
// is basically consenting that other team's setting are used
|
|
export function groupAfterMorph({
|
|
ourGroup,
|
|
theirGroup,
|
|
liker,
|
|
}: {
|
|
ourGroup: LookingGroup;
|
|
theirGroup: LookingGroup;
|
|
liker: "US" | "THEM";
|
|
}) {
|
|
const ourMembers = ourGroup.members ?? [];
|
|
const theirMembers = theirGroup.members ?? [];
|
|
|
|
if (ourMembers.length > theirMembers.length) {
|
|
return ourGroup;
|
|
}
|
|
|
|
if (theirMembers.length > ourMembers.length) {
|
|
return theirGroup;
|
|
}
|
|
|
|
if (liker === "US") {
|
|
return theirGroup;
|
|
}
|
|
|
|
return ourGroup;
|
|
}
|
|
|
|
export function hasGroupManagerPerms(role: GroupMember["role"]) {
|
|
return role === "OWNER" || role === "MANAGER";
|
|
}
|