From 786a03bf86a1d13ba75a1a41d8d3125dfef7e211 Mon Sep 17 00:00:00 2001 From: poignatov Date: Tue, 10 Mar 2026 17:57:03 +0300 Subject: [PATCH] =?UTF-8?q?6.8.3:=20=D0=9F=D0=BE=D1=81=D0=BB=D0=B5=D0=B4?= =?UTF-8?q?=D0=BD=D0=B8=D0=B9=20=D0=BE=D0=B1=D1=8A=D1=91=D0=BC=20=D0=B8?= =?UTF-8?q?=D0=B7=20=D0=B8=D1=81=D1=82=D0=BE=D1=80=D0=B8=D0=B8=20=D0=B2=20?= =?UTF-8?q?=D0=BF=D0=BB=D0=B5=D0=B9=D1=81=D1=85=D0=BE=D0=BB=D0=B4=D0=B5?= =?UTF-8?q?=D1=80=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- VERSION | 2 +- play-life-backend/main.go | 13 +++++++++++++ play-life-web/package.json | 2 +- play-life-web/src/components/ShoppingItemDetail.jsx | 4 ++-- 4 files changed, 17 insertions(+), 4 deletions(-) diff --git a/VERSION b/VERSION index 166d79d..021c940 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -6.8.2 +6.8.3 diff --git a/play-life-backend/main.go b/play-life-backend/main.go index aa417c4..ba31150 100644 --- a/play-life-backend/main.go +++ b/play-life-backend/main.go @@ -17742,6 +17742,7 @@ type ShoppingItem struct { Completed int `json:"completed"` LastCompletedAt *string `json:"last_completed_at,omitempty"` CreatedAt string `json:"created_at"` + LastVolume *float64 `json:"last_volume,omitempty"` } type ShoppingItemRequest struct { @@ -18722,6 +18723,18 @@ func (a *App) getShoppingItemHandler(w http.ResponseWriter, r *http.Request) { } item.CreatedAt = createdAt.Format(time.RFC3339) + // Получаем последний купленный объём из истории + var lastVolume sql.NullFloat64 + a.DB.QueryRow(` + SELECT volume FROM shopping_item_history + WHERE item_id = $1 + ORDER BY completed_at DESC + LIMIT 1 + `, itemID).Scan(&lastVolume) + if lastVolume.Valid { + item.LastVolume = &lastVolume.Float64 + } + w.Header().Set("Content-Type", "application/json") json.NewEncoder(w).Encode(item) } diff --git a/play-life-web/package.json b/play-life-web/package.json index feb31b8..7f105c9 100644 --- a/play-life-web/package.json +++ b/play-life-web/package.json @@ -1,6 +1,6 @@ { "name": "play-life-web", - "version": "6.8.2", + "version": "6.8.3", "type": "module", "scripts": { "dev": "vite", diff --git a/play-life-web/src/components/ShoppingItemDetail.jsx b/play-life-web/src/components/ShoppingItemDetail.jsx index 1833336..627de19 100644 --- a/play-life-web/src/components/ShoppingItemDetail.jsx +++ b/play-life-web/src/components/ShoppingItemDetail.jsx @@ -54,7 +54,7 @@ function ShoppingItemDetail({ itemId, onClose, onRefresh, onItemCompleted, onNav throw new Error('Неверное значение объёма') } } else { - payload.volume = item.volume_base + payload.volume = item.last_volume ?? item.volume_base } const response = await authFetch(`/api/shopping/items/${itemId}/complete`, { @@ -189,7 +189,7 @@ function ShoppingItemDetail({ itemId, onClose, onRefresh, onItemCompleted, onNav step="any" value={volumeValue} onChange={(e) => setVolumeValue(e.target.value)} - placeholder={item.volume_base?.toString() || '1'} + placeholder={(item.last_volume ?? item.volume_base)?.toString() || '1'} className="progression-input" />