You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
• Laravel Version: 11.0
• Nova Version: 5.x
• PHP Version: 8.2
• Database Driver & Version: MySQL 8.0
• Operating System and Version: macOS 14.3
• Browser type and version: Chrome 120
• Reproduction Repository: N/A
Description:
When using the sumByDays method in a Nova Trend metric, the returned trend values appear to be rounded, despite the database storing decimal values with two decimal places.
However, when calling sumByDays, the returned values seem to be rounded, causing the metric chart to display incorrect results. The issue persists even after setting the format method to enforce decimal precision:
2. Ensure the fee column is stored as DECIMAL(10,2).
3. Verify the database values contain two decimal places.
4. Dump $result->trend before returning the response:
dd($result->trend);
5. Observe that the values are rounded, despite expecting two decimal places.
Question:
• Is there an internal rounding mechanism applied in sumByDays?
• How can we enforce decimal precision without rounding in sumByDays?
The text was updated successfully, but these errors were encountered:
Description:
When using the sumByDays method in a Nova Trend metric, the returned trend values appear to be rounded, despite the database storing decimal values with two decimal places.
For example, the database contains:
[
{ "date": "2025-01-06", "total_fee": "0.68" },
{ "date": "2025-01-21", "total_fee": "0.60" }
]
However, when calling sumByDays, the returned values seem to be rounded, causing the metric chart to display incorrect results. The issue persists even after setting the format method to enforce decimal precision:
->format(['thousandSeparated' => true, 'mantissa' => 2])
Detailed steps to reproduce the issue on a fresh Nova installation:
1. Create a Nova metric using sumByDays:
dd($result->trend);
Question:
• Is there an internal rounding mechanism applied in sumByDays?
• How can we enforce decimal precision without rounding in sumByDays?
The text was updated successfully, but these errors were encountered: