6.0.1: Срок разблокировки цели при редактировании
All checks were successful
Build and Push Docker Image / build-and-push (push) Successful in 1m5s

This commit is contained in:
poignatov
2026-03-05 12:59:31 +03:00
parent 027063dfb9
commit ff16f98736
3 changed files with 17 additions and 3 deletions

View File

@@ -1 +1 @@
6.0.0
6.0.1

View File

@@ -1,6 +1,6 @@
{
"name": "play-life-web",
"version": "6.0.0",
"version": "6.0.1",
"type": "module",
"scripts": {
"dev": "vite",

View File

@@ -1409,10 +1409,19 @@ function ConditionForm({ tasks, projects, onSubmit, onCancel, editingCondition,
const [projectId, setProjectId] = useState(editingCondition?.project_id?.toString() || '')
const [requiredPoints, setRequiredPoints] = useState(editingCondition?.required_points?.toString() || '')
const [startDate, setStartDate] = useState(editingCondition?.start_date || '')
const [calculatedWeeksText, setCalculatedWeeksText] = useState(null)
const [calculatedWeeksText, setCalculatedWeeksText] = useState(
editingCondition?.type === 'project_points' ? (editingCondition?.weeks_text ?? null) : null
)
const isEditing = editingCondition !== null
// Показываем срок разблокировки из редактируемого условия до прихода ответа API
useEffect(() => {
if (editingCondition?.type === 'project_points' && editingCondition?.weeks_text) {
setCalculatedWeeksText(editingCondition.weeks_text)
}
}, [editingCondition?.id, editingCondition?.type, editingCondition?.weeks_text])
// Автоподстановка новой задачи
useEffect(() => {
if (preselectedTaskId && !editingCondition) {
@@ -1473,6 +1482,11 @@ function ConditionForm({ tasks, projects, onSubmit, onCancel, editingCondition,
project_id: type === 'project_points' ? parseInt(projectId) : null,
required_points: type === 'project_points' ? parseFloat(requiredPoints) : null,
start_date: type === 'project_points' && startDate ? startDate : null,
...(type === 'project_points' && {
weeks_text: calculatedWeeksText || editingCondition?.weeks_text || null,
}),
...(editingCondition?.id != null && { id: editingCondition.id }),
...(editingCondition?.user_id != null && { user_id: editingCondition.user_id }),
}
onSubmit(condition)
// Сброс формы