wip league admin tools
This commit is contained in:
@@ -24,8 +24,11 @@ export class StrengthOfField implements IValueObject<StrengthOfFieldProps> {
|
||||
throw new RacingDomainValidationError('Strength of field must be an integer');
|
||||
}
|
||||
|
||||
if (value < 0 || value > 100) {
|
||||
throw new RacingDomainValidationError('Strength of field must be between 0 and 100');
|
||||
// SOF represents iRating-like values (commonly ~0-10k), not a 0-100 percentage.
|
||||
if (value < 0 || value > 10_000) {
|
||||
throw new RacingDomainValidationError(
|
||||
'Strength of field must be between 0 and 10000',
|
||||
);
|
||||
}
|
||||
|
||||
return new StrengthOfField(value);
|
||||
@@ -35,9 +38,9 @@ export class StrengthOfField implements IValueObject<StrengthOfFieldProps> {
|
||||
* Get the strength category
|
||||
*/
|
||||
getCategory(): 'beginner' | 'intermediate' | 'advanced' | 'expert' {
|
||||
if (this.value < 25) return 'beginner';
|
||||
if (this.value < 50) return 'intermediate';
|
||||
if (this.value < 75) return 'advanced';
|
||||
if (this.value < 1500) return 'beginner';
|
||||
if (this.value < 2500) return 'intermediate';
|
||||
if (this.value < 4000) return 'advanced';
|
||||
return 'expert';
|
||||
}
|
||||
|
||||
@@ -45,8 +48,8 @@ export class StrengthOfField implements IValueObject<StrengthOfFieldProps> {
|
||||
* Check if this SOF is suitable for the given participant count
|
||||
*/
|
||||
isSuitableForParticipants(count: number): boolean {
|
||||
// Higher SOF should generally have more participants
|
||||
const minExpected = Math.floor(this.value / 10);
|
||||
// Higher SOF should generally have more participants.
|
||||
const minExpected = Math.floor(this.value / 500);
|
||||
return count >= minExpected;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user