diff --git a/VERSION b/VERSION index 09b254e..5fe6072 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -6.0.0 +6.0.1 diff --git a/play-life-web/package.json b/play-life-web/package.json index 4a1e61f..e22a332 100644 --- a/play-life-web/package.json +++ b/play-life-web/package.json @@ -1,6 +1,6 @@ { "name": "play-life-web", - "version": "6.0.0", + "version": "6.0.1", "type": "module", "scripts": { "dev": "vite", diff --git a/play-life-web/src/components/WishlistForm.jsx b/play-life-web/src/components/WishlistForm.jsx index a343e03..8fe6280 100644 --- a/play-life-web/src/components/WishlistForm.jsx +++ b/play-life-web/src/components/WishlistForm.jsx @@ -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) // Сброс формы