Skip to content

Codex-generated pull request#2

Open
maouM-cmd wants to merge 3 commits into
mainfrom
codex/design-gas-company-management-tool
Open

Codex-generated pull request#2
maouM-cmd wants to merge 3 commits into
mainfrom
codex/design-gas-company-management-tool

Conversation

@maouM-cmd

Copy link
Copy Markdown
Owner

Codex generated this pull request, but encountered an unexpected error after generation. This is a placeholder PR message.


Codex Task

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 53b4e0e866

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".


class MeterReading(BaseTimestampModel):
customer = models.ForeignKey(Customer, on_delete=models.PROTECT, related_name="meter_readings", verbose_name="顧客")
reading_month = models.DateField("検針月")

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Enforce month-granular uniqueness for meter readings

reading_month is a DateField, so the uniqueness constraint on (customer, reading_month) only blocks exact same dates, not duplicate entries within the same billing month; for example, the same customer can save both 2025-02-01 and 2025-02-28. This breaks the intended YYYY-MM data model and can lead to duplicate monthly billing records and invoices.

Useful? React with 👍 / 👎.

Comment thread gas_mvp_project/core/views.py Outdated
Comment on lines +10 to +13
"unread_meter_count": Customer.objects.filter(is_active=True).count()
- MeterReading.objects.filter(
reading_month__year=timezone.now().year, reading_month__month=timezone.now().month
).count(),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Compute unread meter count from active-customer gaps

The unread meter KPI subtracts all current-month reading rows from the active customer count, so readings tied to inactive customers (or multiple rows in one month) incorrectly reduce the number and can even make it negative. This underreports pending work on the dashboard whenever current-month readings are not a one-to-one set of active customers.

Useful? React with 👍 / 👎.

reading_month__year=timezone.now().year, reading_month__month=timezone.now().month
).count(),
"unissued_invoice_count": MeterReading.objects.filter(invoice__isnull=True).count(),
"unpaid_invoice_count": Invoice.objects.exclude(status="paid").count(),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Exclude cancelled invoices from unpaid totals

Using exclude(status="paid") for unpaid_invoice_count treats cancelled invoices as unpaid, which inflates the dashboard’s未入金件数 once cancellations occur and misleads collection tracking. This metric should only include collectible/open invoices rather than every non-paid status.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant