feat: sort draft room and auto-pick by VORP instead of expected value
Update draft participant sorting to use vorpValue column instead of expectedValue in draft room initialization and auto-pick selection for both single-sport and multi-sport seasons. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
3c740c50bf
commit
8ee5a8008e
2 changed files with 8 additions and 8 deletions
|
|
@ -283,12 +283,12 @@ export async function getTopAvailableParticipant(
|
|||
allParticipants.push(...seasonParticipants);
|
||||
}
|
||||
|
||||
// Sort by EV desc, then name (expectedValue is a decimal string from DB)
|
||||
// Sort by VORP desc, then name
|
||||
allParticipants.sort((a, b) => {
|
||||
const evA = parseFloat(String(a.expectedValue)) || 0;
|
||||
const evB = parseFloat(String(b.expectedValue)) || 0;
|
||||
if (evB !== evA) {
|
||||
return evB - evA;
|
||||
const vorpA = parseFloat(String(a.vorpValue)) || 0;
|
||||
const vorpB = parseFloat(String(b.vorpValue)) || 0;
|
||||
if (vorpB !== vorpA) {
|
||||
return vorpB - vorpA;
|
||||
}
|
||||
return a.name.localeCompare(b.name);
|
||||
});
|
||||
|
|
@ -301,7 +301,7 @@ export async function getTopAvailableParticipant(
|
|||
.select()
|
||||
.from(schema.participants)
|
||||
.where(eq(schema.participants.sportsSeasonId, sportsSeasonIds[0]))
|
||||
.orderBy(desc(schema.participants.expectedValue), schema.participants.name);
|
||||
.orderBy(desc(schema.participants.vorpValue), schema.participants.name);
|
||||
|
||||
if (draftedIds.length > 0) {
|
||||
query = db
|
||||
|
|
@ -313,7 +313,7 @@ export async function getTopAvailableParticipant(
|
|||
notInArray(schema.participants.id, draftedIds)
|
||||
)
|
||||
)
|
||||
.orderBy(desc(schema.participants.expectedValue), schema.participants.name);
|
||||
.orderBy(desc(schema.participants.vorpValue), schema.participants.name);
|
||||
}
|
||||
|
||||
const [topParticipant] = await query;
|
||||
|
|
|
|||
|
|
@ -178,7 +178,7 @@ export async function loader(args: Route.LoaderArgs) {
|
|||
: inArray(schema.participants.sportsSeasonId, sportsSeasonIds)
|
||||
)
|
||||
.orderBy(
|
||||
desc(schema.participants.expectedValue),
|
||||
desc(schema.participants.vorpValue),
|
||||
asc(schema.participants.name)
|
||||
)
|
||||
: [];
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue