Skip to content

Fix data enrichment before print, Timezone, and add UI#1

Open
BobbyLindsey wants to merge 3 commits into
mainfrom
FixDataEnrichmentBeforePrint
Open

Fix data enrichment before print, Timezone, and add UI#1
BobbyLindsey wants to merge 3 commits into
mainfrom
FixDataEnrichmentBeforePrint

Conversation

@BobbyLindsey
Copy link
Copy Markdown
Contributor

Fixes an issue where the label would print before all data was received. Fixed data collection also.

Fixed issue where it would always use UTC. Now uses local timezone.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses premature label printing by deferring print attempts until print-start events have complete enrichment data (duration/filament/ETA), and adjusts label timestamp formatting to display in the system’s local timezone.

Changes:

  • Add a wait/defer workflow so labels aren’t printed until events are sufficiently enriched, plus a periodic “pending labels” pass to print deferred events once data arrives.
  • Improve print-job ↔ event matching by allowing more flexible filename compatibility checks.
  • Update label timestamp rendering to convert timestamps to the local timezone, and add new configuration/env settings for the wait/defer behavior.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/printerprinter/storage.py Adds a helper to check whether a label job attempt exists for an event.
src/printerprinter/main.py Implements defer/wait logic before printing, adds pending label processing, and relaxes filename matching rules.
src/printerprinter/labeling.py Converts displayed timestamps to local timezone (treating naive timestamps as UTC).
src/printerprinter/config.py Adds settings for label wait window, poll interval during wait, and max age for pending labels.
README.md Documents new environment variables controlling label wait/defer behavior.
.env.example Adds example values for the new environment variables.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 1 to +3
from __future__ import annotations

from datetime import datetime
from datetime import UTC, datetime
limit: int = 50,
) -> int:
recent_events = list_recent_print_start_events(db_path, limit=limit)
now = datetime.now(UTC)
Comment on lines +663 to +667
event_row = await _wait_for_event_data(
client,
db_path,
event_id=int(result["event"]["id"]),
timeout_seconds=label_wait_seconds,
@BobbyLindsey BobbyLindsey changed the title Fix data enrichment before print Fix data enrichment before print, Timezone, and add UI May 29, 2026
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.

2 participants