Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

feat: combine duplicate quick-add entries on same date instead of stacking

Adam Eivye3c67d35a645
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.md
index f3e2dfd23d..30fe6793b4 100644
--- a/.changelog/NEXT.md
+++ b/.changelog/NEXT.md
@@ -12,6 +12,7 @@
- Interactive storage backend chooser during setup: Docker PostgreSQL, Native PostgreSQL, or file-based JSON (deprecated) when Docker is unavailable
## Changed
+- Quick-add buttons for alcohol and nicotine now combine duplicate entries on the same date by incrementing count instead of stacking separate rows
- Extracted shared `dayOfWeek` utility and `DAY_LABELS` constant to meatspace constants (deduplicated from AlcoholTab)
- Health correlation endpoint now includes heart rate, resting heart rate, and nicotine data alongside existing HRV/alcohol/steps
- NicotineHealthCorrelation tooltip uses Tailwind classes instead of inline styles for consistency
diff --git a/server/services/meatspaceAlcohol.js b/server/services/meatspaceAlcohol.js
index 2ee67c3b49..a6283a53d4 100644
--- a/server/services/meatspaceAlcohol.js
+++ b/server/services/meatspaceAlcohol.js
@@ -204,7 +204,13 @@ export async function logDrink({ name, oz, abv, count = 1, date }) {
entry.alcohol = { drinks: [], standardDrinks: 0 };
}
- entry.alcohol.drinks.push(drink);
+ // Combine with existing matching drink on same date
+ const existing = entry.alcohol.drinks.find(d => d.name === drink.name && d.oz === drink.oz && d.abv === drink.abv);
+ if (existing) {
+ existing.count = (existing.count || 1) + count;
+ } else {
+ entry.alcohol.drinks.push(drink);
+ }
recalcAlcoholTotal(entry);
diff --git a/server/services/meatspaceNicotine.js b/server/services/meatspaceNicotine.js
index 7489435d50..384edbce34 100644
--- a/server/services/meatspaceNicotine.js
+++ b/server/services/meatspaceNicotine.js
@@ -160,7 +160,13 @@ export async function logNicotine({ product, mgPerUnit, count = 1, date }) {
entry.nicotine = { items: [], totalMg: 0 };
}
- entry.nicotine.items.push(item);
+ // Combine with existing matching product on same date
+ const existing = entry.nicotine.items.find(i => i.product === item.product && i.mgPerUnit === item.mgPerUnit);
+ if (existing) {
+ existing.count = (existing.count || 1) + count;
+ } else {
+ entry.nicotine.items.push(item);
+ }
recalcDayTotal(entry);
// Re-sort and update lastEntryDate