Remove points limit
This commit is contained in:
@@ -366,7 +366,7 @@ async def save_challenges(
|
|||||||
description=ch_data.description,
|
description=ch_data.description,
|
||||||
type=ch_type,
|
type=ch_type,
|
||||||
difficulty=difficulty,
|
difficulty=difficulty,
|
||||||
points=max(1, min(500, ch_data.points)),
|
points=max(1, ch_data.points),
|
||||||
estimated_time=ch_data.estimated_time,
|
estimated_time=ch_data.estimated_time,
|
||||||
proof_type=proof_type,
|
proof_type=proof_type,
|
||||||
proof_hint=ch_data.proof_hint,
|
proof_hint=ch_data.proof_hint,
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ class ChallengeBase(BaseModel):
|
|||||||
description: str = Field(..., min_length=1)
|
description: str = Field(..., min_length=1)
|
||||||
type: ChallengeType
|
type: ChallengeType
|
||||||
difficulty: Difficulty
|
difficulty: Difficulty
|
||||||
points: int = Field(..., ge=1, le=1000)
|
points: int = Field(..., ge=1)
|
||||||
estimated_time: int | None = Field(None, ge=1) # minutes
|
estimated_time: int | None = Field(None, ge=1) # minutes
|
||||||
proof_type: ProofType
|
proof_type: ProofType
|
||||||
proof_hint: str | None = None
|
proof_hint: str | None = None
|
||||||
@@ -34,7 +34,7 @@ class ChallengeUpdate(BaseModel):
|
|||||||
description: str | None = None
|
description: str | None = None
|
||||||
type: ChallengeType | None = None
|
type: ChallengeType | None = None
|
||||||
difficulty: Difficulty | None = None
|
difficulty: Difficulty | None = None
|
||||||
points: int | None = Field(None, ge=1, le=1000)
|
points: int | None = Field(None, ge=1)
|
||||||
estimated_time: int | None = None
|
estimated_time: int | None = None
|
||||||
proof_type: ProofType | None = None
|
proof_type: ProofType | None = None
|
||||||
proof_hint: str | None = None
|
proof_hint: str | None = None
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ class GameCreate(GameBase):
|
|||||||
game_type: GameType = GameType.CHALLENGES
|
game_type: GameType = GameType.CHALLENGES
|
||||||
|
|
||||||
# Поля для типа "Прохождение"
|
# Поля для типа "Прохождение"
|
||||||
playthrough_points: int | None = Field(None, ge=1, le=1000)
|
playthrough_points: int | None = Field(None, ge=1)
|
||||||
playthrough_description: str | None = None
|
playthrough_description: str | None = None
|
||||||
playthrough_proof_type: ProofType | None = None
|
playthrough_proof_type: ProofType | None = None
|
||||||
playthrough_proof_hint: str | None = None
|
playthrough_proof_hint: str | None = None
|
||||||
@@ -46,7 +46,7 @@ class GameUpdate(BaseModel):
|
|||||||
game_type: GameType | None = None
|
game_type: GameType | None = None
|
||||||
|
|
||||||
# Поля для типа "Прохождение"
|
# Поля для типа "Прохождение"
|
||||||
playthrough_points: int | None = Field(None, ge=1, le=1000)
|
playthrough_points: int | None = Field(None, ge=1)
|
||||||
playthrough_description: str | None = None
|
playthrough_description: str | None = None
|
||||||
playthrough_proof_type: ProofType | None = None
|
playthrough_proof_type: ProofType | None = None
|
||||||
playthrough_proof_hint: str | None = None
|
playthrough_proof_hint: str | None = None
|
||||||
|
|||||||
@@ -124,12 +124,6 @@ points: easy=20-40, medium=45-75, hard=90-150
|
|||||||
points = ch.get("points", 30)
|
points = ch.get("points", 30)
|
||||||
if not isinstance(points, int) or points < 1:
|
if not isinstance(points, int) or points < 1:
|
||||||
points = 30
|
points = 30
|
||||||
if difficulty == "easy":
|
|
||||||
points = max(20, min(40, points))
|
|
||||||
elif difficulty == "medium":
|
|
||||||
points = max(45, min(75, points))
|
|
||||||
elif difficulty == "hard":
|
|
||||||
points = max(90, min(150, points))
|
|
||||||
|
|
||||||
return ChallengeGenerated(
|
return ChallengeGenerated(
|
||||||
title=ch.get("title", "Unnamed Challenge")[:100],
|
title=ch.get("title", "Unnamed Challenge")[:100],
|
||||||
|
|||||||
@@ -949,7 +949,6 @@ export function LobbyPage() {
|
|||||||
value={editChallenge.points}
|
value={editChallenge.points}
|
||||||
onChange={(e) => setEditChallenge(prev => ({ ...prev, points: parseInt(e.target.value) || 0 }))}
|
onChange={(e) => setEditChallenge(prev => ({ ...prev, points: parseInt(e.target.value) || 0 }))}
|
||||||
min={1}
|
min={1}
|
||||||
max={1000}
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
@@ -1109,7 +1108,6 @@ export function LobbyPage() {
|
|||||||
value={newChallenge.points}
|
value={newChallenge.points}
|
||||||
onChange={(e) => setNewChallenge(prev => ({ ...prev, points: parseInt(e.target.value) || 0 }))}
|
onChange={(e) => setNewChallenge(prev => ({ ...prev, points: parseInt(e.target.value) || 0 }))}
|
||||||
min={1}
|
min={1}
|
||||||
max={1000}
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
@@ -1351,7 +1349,6 @@ export function LobbyPage() {
|
|||||||
value={editChallenge.points}
|
value={editChallenge.points}
|
||||||
onChange={(e) => setEditChallenge(prev => ({ ...prev, points: parseInt(e.target.value) || 0 }))}
|
onChange={(e) => setEditChallenge(prev => ({ ...prev, points: parseInt(e.target.value) || 0 }))}
|
||||||
min={1}
|
min={1}
|
||||||
max={1000}
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
@@ -1974,7 +1971,6 @@ export function LobbyPage() {
|
|||||||
value={playthroughPoints}
|
value={playthroughPoints}
|
||||||
onChange={(e) => setPlaythroughPoints(parseInt(e.target.value) || 50)}
|
onChange={(e) => setPlaythroughPoints(parseInt(e.target.value) || 50)}
|
||||||
min={1}
|
min={1}
|
||||||
max={1000}
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
@@ -2151,7 +2147,6 @@ export function LobbyPage() {
|
|||||||
value={editPlaythroughPoints}
|
value={editPlaythroughPoints}
|
||||||
onChange={(e) => setEditPlaythroughPoints(parseInt(e.target.value) || 50)}
|
onChange={(e) => setEditPlaythroughPoints(parseInt(e.target.value) || 50)}
|
||||||
min={1}
|
min={1}
|
||||||
max={1000}
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
|
|||||||
Reference in New Issue
Block a user