solid-adventure / trivial-api

Other
1 stars 1 forks source link

return before group if no results #233

Closed vgkids closed 9 months ago

vgkids commented 9 months ago

Before Rendering a report with a group that contains no results crashes:

undefined method `meta' for nil:NilClass

      return registers.first.meta.values + ["register_id"]
                            ^^^^^
Screenshot 2024-02-15 at 7 22 08 PM

After Limited to a single register, nice clean No Results message.

Screenshot 2024-02-15 at 7 21 46 PM

Pulling from multiple registers with non-matching columns correctly refuses to render:

Screenshot 2024-02-15 at 7 49 46 PM

Panel Options used for testing. Note that income_account is a valid group_by arg for the register.

{
  "options": {
    "title": "Sum, Group by Income Account",
    "full_width": false,
    "countFormat": {
      "args": {
        "places": 2
      },
      "type": "money"
    },
    "data_source": {
      "args": {
        "path": "reports/item_sum",
        "group_by": [
          "income_account"
        ]
      },
      "type": "trivial-api"
    },
    "display_total": true
  },
  "component": "HeadlineTable"
}