Skip to content

Conversation

@iryadifarhan
Copy link

Hello!

I found another one, this one is a bit tricky and might be an edge case but still, I think it still confuses someone when a negative symbol is inconsistent between each other in Audit Log, so please check it out if you think so.

Preconditions 📝

  • I set audit interval in Notification admin settings to be empty
    Screenshot_26-11-2025_13101_localhost

  • I have 2 assets and audited both with different treatment (check images below for differences)
    First Test Asset
    Screenshot_26-11-2025_1371_localhost
    Second Test Asset
    Screenshot_26-11-2025_13720_localhost

Bug 🐛

On Audit Log page, it displayed a negative symbol only for the First Asset.
Screenshot 2025-11-26 130903

This happens because:

  1. Filled Next Audit Date input only gives the date format only (2025-11-26)
  2. Emptied Next Audit Date has a logic to use the Actionlog Date (which includes time) and adds it with the Audit Interval (2026-11-26 12:09:44)

So, referring to the current comparison logic

// Show as negative number if the next audit date is before the audit date we're looking at
if ($this->created_at > $override_default_next) {
    $next_audit_days = '-'.$next_audit_days;
}

Then it would be:

  • First Asset: 2025-11-26 12:08:11 > 2025-11-26 → True (display negative)
  • Second Asset: 2025-11-26 12:09:44 > 2026-11-26 12:09:44 → False (not displaying negative)

Proposed Solution 💡

Uses the toDateString() to compare only the dates, so the comparing logic is always equal (date vs date), giving a consistent comparison logic to decide negative symbol

// Show as negative number if the next audit date is before the audit date we're looking at
if ($this->created_at->toDateString() > $override_default_next->toDateString()) {
    $next_audit_days = '-'.$next_audit_days;
}

Fixed Result ✅

Screenshot 2025-11-26 130947

@iryadifarhan iryadifarhan requested a review from snipe as a code owner November 27, 2025 00:28
@iryadifarhan iryadifarhan changed the base branch from master to develop November 27, 2025 06:40
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.

1 participant