Skip to content

feat: implement PendingDailyCountsView with edit dialog and sticky header#72

Merged
Pertempto merged 30 commits intomainfrom
63-pending-daily-counts
Oct 17, 2025
Merged

feat: implement PendingDailyCountsView with edit dialog and sticky header#72
Pertempto merged 30 commits intomainfrom
63-pending-daily-counts

Conversation

@Pertempto
Copy link
Contributor

Summary

  • Implement PendingDailyCountsView component based on PendingBinsView
  • Add count editing dialog with number input for flexible count entry
  • Implement sticky header showing total bins count
  • Update SMS message format to include date, picker, daily count, and weekly count
  • Bump version to 2025.10.17.4

Resolves #63

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Oct 17, 2025

Deploying bintraq with  Cloudflare Pages  Cloudflare Pages

Latest commit: 8e7ca85
Status: ✅  Deploy successful!
Preview URL: https://d342e37b.bintraq.pages.dev
Branch Preview URL: https://63-pending-daily-counts.bintraq.pages.dev

View logs

@github-actions
Copy link

In app/src/views/PendingDailyCountsView.vue, the Supabase queries for allDailyCounts and allWeeklyCounts are incorrectly using .select("picker", { count: "exact" }), which is invalid syntax. It should be .select("picker, count") to select the picker and count fields. Additionally, the summation logic is using (dailyCountsFromDB[count.picker] ?? 0) + 1, which increments by 1 for each entry, but it should be + count.count to sum the actual bin counts.

@github-actions
Copy link

In app/src/views/PendingDailyCountsView.vue, the saveCount function directly modifies the local object and calls updateDailyCount without awaiting or reloading the list. This could lead to UI inconsistency if the update fails. Consider awaiting the update and reloading the pending counts, similar to how deleteDailyCount does it.

@github-actions
Copy link

github-actions bot commented Oct 17, 2025

Changes Requested

  • Add fetch for today's non-pending daily counts in sendDailyCounts to compute accurate totals.
  • Group SMS messages by picker in sendDailyCounts to send one per picker with correct dayCount.
  • Add try-catch block in updateCount for error handling and UI consistency.

Summary of Changes

  • Implemented PendingDailyCountsView with sticky header, edit dialog, and pending count management.
  • Updated SMS format to include date, picker, daily count, and weekly count (needs grouping and total fixes).
  • Incremented appVersion to '2025.10.17.4'.
  • Added coding guidelines in AGENTS.md and updated spec status.

Overall Feedback

@Pertempto, solid start on the daily counts UI with a clean edit dialog and sticky total header 👍. The SMS totals are off without fetching today's DB counts and grouping by picker—fix those to avoid wrong numbers and message spam 📱. Error handling in updates will prevent sneaky failures—try-catch is your friend 🤝. Title and version bump are on point 😎.

- Fix Supabase select syntax from .select('picker', { count: 'exact' }) to .select('picker, count')
- Correct summation logic to use count.count instead of incrementing by 1
- Make saveCount async and await API call with data reload
- Bump version to 2025.10.17.5
…pdateCount

- Move send button from bottom of list to sticky header for better UX
- Rename saveCount to updateCount for accuracy since it updates existing counts
- Revert version to 2025.10.17.4 as requested
- Remove bottom border from sticky header
- Add rounded corners for better visual design
- Add top margin for spacing from navigation bar
@github-actions
Copy link

In PendingDailyCountsView.vue, the Supabase select queries for allDailyCounts and allWeeklyCounts are using invalid syntax .select("picker", { count: "exact" }). Change it to .select("picker, count") to properly select the picker and count fields.

@github-actions
Copy link

In PendingDailyCountsView.vue, the summation logic for dailyCountsFromDB and weeklyCountsFromDB is incorrectly incrementing by + 1 instead of + count.count. It should sum the actual count values: (dailyCountsFromDB[count.picker] ?? 0) + count.count

@github-actions
Copy link

In sendDailyCounts, the SMS content uses Cajas hoy: ${dailyCount.count}, but it should use the total daily count (dayCount) calculated earlier. Currently, if there are multiple pending daily counts for the same picker, it sends separate messages with each count, which may not be intended. Consider grouping the messages by picker to send one message per picker with the total daily count.

- Change top-0 to top-2 to maintain gap from navigation when scrolling
- Remove mt-2 since top-2 provides the spacing
@github-actions
Copy link

In PendingDailyCountsView.vue, the saveCount function (updateCount) modifies the local object but directly awaits updateDailyCount and reloads. This avoids UI inconsistency if update fails, which is good. As long as no error handling is added, it might silently fail—consider adding try-catch for better UX.

@github-actions
Copy link

In updateCount, consider wrapping the update in try-catch to handle potential failures and inform the user if the update doesn't succeed, improving UX.

@github-actions
Copy link

In app/src/views/PendingDailyCountsView.vue, the SMS content uses Cajas hoy: ${dailyCount.count}, but dayCount is calculated as the total daily count including pending. Use ${dayCount} instead to send the correct total.

Also, if multiple pending counts exist for the same picker, multiple messages are sent. Consider grouping by picker to send one message per picker with the total day count.

@github-actions
Copy link

In updateCount function in PendingDailyCountsView.vue, wrap the update logic in try-catch to handle failures. On error, show a user alert and avoid UI inconsistency, e.g., try { ... await updateDailyCount... await load... } catch (e) { alert('Failed to update'); await loadPendingDailyCounts(); }

@github-actions
Copy link

content here

@github-actions
Copy link

In app/src/views/PendingDailyCountsView.vue, the sendDailyCounts function currently uses dailyCount.count for "Cajas hoy" in the SMS content. This should be changed to use the calculated dayCount to provide the total daily count including all pending counts for the picker.

1 similar comment
@github-actions
Copy link

In app/src/views/PendingDailyCountsView.vue, the sendDailyCounts function currently uses dailyCount.count for "Cajas hoy" in the SMS content. This should be changed to use the calculated dayCount to provide the total daily count including all pending counts for the picker.

@github-actions
Copy link

In app/src/views/PendingDailyCountsView.vue, in the sendDailyCounts function, the SMS message uses Cajas hoy: ${dailyCount.count}. Change this to ${dayCount} to reflect the total daily count for the picker, including all pending adjustments.

@github-actions
Copy link

In app/src/views/PendingDailyCountsView.vue, the sendDailyCounts function sets the SMS message content to Cajas hoy: ${dailyCount.count}, but this should be changed to ${dayCount} to display the total daily count for the picker, including all pending counts being sent.

@github-actions
Copy link

...

1 similar comment
@github-actions
Copy link

...

@github-actions
Copy link

In sendDailyCounts, the SMS content uses Cajas hoy: ${dailyCount.count}, but it should use the total daily count (dayCount)

The code in app/src/views/PendingDailyCountsView.vue still uses dailyCount.count for "Cajas hoy" in the SMS message. Please update it to use ${dayCount} to reflect the complete daily count after sending the pendings.

@github-actions
Copy link

Consider grouping the messages by picker to send one message per picker with the total daily count.

If there are multiple pending daily counts for the same picker, the current implementation sends separate SMS messages. To improve this, please group the counts by picker and send one consolidated SMS per picker.

@github-actions
Copy link

In sendDailyCounts, the SMS content uses Cajas hoy: ${dailyCount.count}, but it should use the total daily count (dayCount)

The code in app/src/views/PendingDailyCountsView.vue still uses dailyCount.count for "Cajas hoy" in the SMS message. Please update it to use ${dayCount} to reflect the complete daily count after sending the pendings.

@github-actions
Copy link

Add try-catch error handling to the updateCount function in app/src/views/PendingDailyCountsView.vue to alert users on update failures and ensure the list reloads, preventing silent failures.

@github-actions
Copy link

In app/specs/63-experimental-daily-count-ui.md, the PendingDailyCountsView is marked as complete with SMS including totals, but the implementation doesn't group messages or calculate correct daily counts. Consider updating the spec to note the incomplete parts or fully implement as described.

@github-actions
Copy link

@Pertempto, to fully implement the PendingDailyCountsView as per the spec, the SMS sending needs to group messages by picker and calculate total daily counts including today's already sent pending counts. Currently, it sends separate messages without considering existing daily totals.

- Convert onMounted callback to async function
- Replace .then() with await for better readability
- Follow modern async/await pattern
- Remove unnecessary pickers variable
- Inline getPickers() call directly into getSettings()
- Reduce code verbosity
- Add guidance about avoiding unnecessary variables
- Include examples of when to inline vs when to use variables
- Promote cleaner, more concise code
@github-actions
Copy link

In app/src/views/PendingDailyCountsView.vue, the sendDailyCounts function sends a separate SMS for each pending daily count entry, which can result in multiple messages for pickers with multiple pending entries. Group the messages by picker and send one consolidated SMS per picker with the total daily count and weekly count.

@github-actions
Copy link

In app/src/views/PendingDailyCountsView.vue, the sendDailyCounts function uses Cajas hoy: ${dailyCount.count}, but it should use the total daily count for the picker, including adjustments from all pending entries plus today's non-pending counts from the DB.

@github-actions
Copy link

In sendDailyCounts, add logic to fetch today's non-pending daily counts from the database to accurately calculate the total dayCount for each picker.

Wrap the fetch in a try-catch if needed, but ensure you fetch:

const { data: allDailyCounts } = await supabase
  .from("dailyCount")
  .select("picker, count")
  .gte("date", startOfDay.toISOString())
  .lt("date", new Date(startOfDay.getTime() + 24 * 60 * 60 * 1000).toISOString())
  .eq("isPending", false);

Then sum them into dailyCountsFromDB similar to weekly.

@github-actions
Copy link

In updateCount, wrap the update logic in try-catch to handle potential failures and ensure UI consistency.

@github-actions
Copy link

In app/src/views/PendingDailyCountsView.vue, the sendDailyCounts function is missing the fetch for today's non-pending daily counts. You need to query and sum them by picker to calculate the correct total for each picker in the SMS.

@github-actions
Copy link

In app/src/views/PendingDailyCountsView.vue, group the SMS messages by picker in sendDailyCounts instead of looping over each pending count. Sum the pending adjustments per picker and send one consolidated SMS with the total dayCount and weekCount for each picker.

@github-actions
Copy link

In app/src/views/PendingDailyCountsView.vue, the SMS content uses Cajas hoy: ${dailyCount.count} for each pending entry, but it should use the total daily count for the picker (DB + all pendings for that picker). Update to use ${dayCount} once calculated correctly.

@github-actions
Copy link

In app/src/views/PendingDailyCountsView.vue, wrap the updateCount function with try-catch to handle potential Supabase update failures. Alert the user on error and reload the list to maintain UI consistency.

- Convert updateCount to use guard clause pattern
- Add guard clause guidelines to AGENTS.md
- Promote reduced nesting and better readability
@github-actions
Copy link

In app/src/views/PendingDailyCountsView.vue, the sendDailyCounts function is missing a fetch for today's non-pending daily counts. You need to query daily counts for today where isPending=false, sum them by picker, and add to the dayCount calculation for accurate totals in the SMS.

@github-actions
Copy link

In app/src/views/PendingDailyCountsView.vue, the sendDailyCounts function sends a separate SMS for each pending daily count, even for the same picker. Group the messages by picker to send one consolidated SMS per picker with the total day count and weekly count, avoiding multiple messages.

@github-actions
Copy link

In app/src/views/PendingDailyCountsView.vue, the SMS content uses ${dailyCount.count} for "Cajas hoy", but it should use the total daily count including DB counts and all pending adjustments for the picker (dayCount). The weekly count is correctly calculated with totals.

@github-actions
Copy link

In app/src/views/PendingDailyCountsView.vue, the updateCount function lacks try-catch error handling around the Supabase update. Wrap it in try-catch to alert the user on failure and reload the list to maintain UI consistency.

@github-actions
Copy link

In app/specs/63-experimental-daily-count-ui.md, the PendingDailyCountsView tasks are marked as complete, including SMS with totals. However, the implementation doesn't yet calculate correct totals or group messages. Consider updating the spec to reflect the current state or complete the implementation to match.

@github-actions
Copy link

In app/src/views/PendingDailyCountsView.vue, the sendDailyCounts function needs to fetch today's non-pending daily counts from the database to calculate accurate dayCount for each picker. Add a query similar to the weekly counts but for today (using startOfDay and endOfDay), sum by picker, and include in dayCount = dailyCountsFromDB[picker] + totalPendingForPicker.

@github-actions
Copy link

In app/src/views/PendingDailyCountsView.vue, group the SMS messages by picker in sendDailyCounts instead of sending one per pending count. Calculate total pending sum per picker, compute total day and week counts, and push one message per picker to avoid spamming pickers with multiple pending entries.

@github-actions
Copy link

In app/src/views/PendingDailyCountsView.vue, update the SMS content to use ${dayCount} instead of ${dailyCount.count} for "Cajas hoy" once dayCount is properly calculated as DB counts + pending adjustments.

@github-actions
Copy link

In app/src/views/PendingDailyCountsView.vue, wrap the updateCount function in try-catch to handle potential update failures. Alert the user on error and reload the list to ensure UI consistency and prevent silent failures.

- Add 'curly' ESLint rule to enforce braces for all if blocks
- Update AGENTS.md to emphasize brace usage in guard clauses
- Fix unused import in PendingDailyCountsView
- Ignore .vite directory in ESLint to avoid dependency file errors
@github-actions
Copy link

In sendDailyCounts, add a fetch for today's non-pending daily counts (similar to weekly counts) to accurately compute dayCount per picker for the SMS totals.

Example:

// Fetch all non-pending daily counts for today
const { data: allDailyCounts } = await supabase
  .from("dailyCount")
  .select("picker, count")
  .gte("date", startOfDay.toISOString())
  .lt("date", new Date(startOfDay.getTime() + 86400000).toISOString())
  .eq("isPending", false);

const dailyCountsFromDB: Record<string, number> = {};
allDailyCounts?.forEach((count) => {
  dailyCountsFromDB[count.picker] = (dailyCountsFromDB[count.picker] ?? 0) + count.count;
});

Then use dayCount = dailyCountsFromDB[picker] + totalPending in grouped messages.

@github-actions
Copy link

Restructure sendDailyCounts to group pending counts by picker before sending messages. Compute total pending sum per picker, calculate dayCount (DB + total pending) and weekCount, and send one consolidated SMS per picker instead of separate messages per pending count.

This prevents spamming pickers with multiple SMS and ensures accurate totals in "Cajas hoy".

@github-actions
Copy link

Wrap updateCount logic in try-catch for error handling:

try {
  await updateDailyCount(editingCount.value);
  await loadPendingDailyCounts();
  editingCount.value = null;
} catch (e) {
  alert('Failed to update count.');
  await loadPendingDailyCounts();
}

This alerts on update failures and reloads the list to maintain UI consistency.

@Pertempto Pertempto merged commit 4847bd8 into main Oct 17, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: experimental daily count interface

1 participant