huginn_datatable 0.4.2 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +1 -1
- data/README.pt-BR.md +1 -1
- data/lib/huginn/datatable/datatable.rb +2 -0
- data/lib/huginn/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c95231f872fd90d2d8dc0a3f351c5648c29cff6543985c95b0fc36ecc5b351c0
|
|
4
|
+
data.tar.gz: 6ccd8840db434f657619e278e98ff6024037e61258ea5115abaf463c33a7fde7
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3b18e30b5af9d01f88e49b95f8971856418ebd327bc87a3c29a8c2b6d987a2f2fee9a35ab5c8726d294175d7ddcec281ecab09a238c28a69fc10afeb8abb3640
|
|
7
|
+
data.tar.gz: 9de963497c159849bc4b6d4e12fc73dca5219394288264802f7af63d1451c9c419d5ee39b8266fe5019bad0db291a660463ce64924800063fa1b34c33b21687d
|
data/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
### Unreleased
|
|
4
4
|
|
|
5
|
+
#### 0.5.0
|
|
6
|
+
|
|
7
|
+
- **Fix (changes results):** `range_data` on a datetime column now covers whole days. The dates were compared as midnight, so the last day was left out and a single-day range (`["2024-03-10", "2024-03-10"]`, which Arel turns into `= '2024-03-10'`) only matched rows created exactly at 00:00:00. Now `from` is the start of its day and `to` the end of its day, in `Time.zone`. Date and numeric columns are unchanged. If a caller compensated by sending the day after as `to`, drop that adjustment when upgrading, or the range will include one extra day.
|
|
8
|
+
|
|
5
9
|
#### 0.4.2
|
|
6
10
|
|
|
7
11
|
- **Performance (PostgreSQL):** association matches in `search` are written as `fk = ANY(ARRAY(SELECT DISTINCT ...))` instead of `fk IN (SELECT DISTINCT ...)`. The `IN` form was planned as a hashed SubPlan, which can't take part in a BitmapOr: a single association column (e.g. `searchable_columns :title, company: [:name]`) made the whole OR fall back to filtering every row, ignoring the GIN trigram/tsvector indexes. `ANY(ARRAY(...))` runs once as an InitPlan and keeps the index plan (measured on 20k-30k rows: ~500 ms → ~1 ms for a selective term). Results are unchanged; other adapters keep `IN`.
|
data/README.md
CHANGED
|
@@ -131,7 +131,7 @@ Supported params:
|
|
|
131
131
|
| `page`, `per_page` | Pagination (clamped to `pagy_max_items`) |
|
|
132
132
|
| `search` | Delegates to `Huginn::Searchable.search` |
|
|
133
133
|
| `filters` | Hash (`{ "col" => v }` or `{ "col" => [a, b] }`) / Array of hashes / pairs -> exact or `IN` conditions (`"col" => "null"` → `IS NULL`) |
|
|
134
|
-
| `range_data` | `{ "created_at" => ["2024-01-01", "2024-12-31"] }` — date or numeric ranges |
|
|
134
|
+
| `range_data` | `{ "created_at" => ["2024-01-01", "2024-12-31"] }` — date or numeric ranges, both ends inclusive (on a datetime column the dates cover whole days) |
|
|
135
135
|
| `orders` | `[{ "pessoa.nome" => "desc" }]` — plain or association-scoped columns |
|
|
136
136
|
|
|
137
137
|
### Array columns (PostgreSQL)
|
data/README.pt-BR.md
CHANGED
|
@@ -131,7 +131,7 @@ Parâmetros suportados:
|
|
|
131
131
|
| `page`, `per_page` | Paginação (limitada a `pagy_max_items`) |
|
|
132
132
|
| `search` | Delega para `Huginn::Searchable.search` |
|
|
133
133
|
| `filters` | Hash (`{ "col" => v }` ou `{ "col" => [a, b] }`) / Array de hashes / pares -> condições exatas ou `IN` (`"col" => "null"` → `IS NULL`) |
|
|
134
|
-
| `range_data` | `{ "created_at" => ["2024-01-01", "2024-12-31"] }` — ranges de datas ou numéricos |
|
|
134
|
+
| `range_data` | `{ "created_at" => ["2024-01-01", "2024-12-31"] }` — ranges de datas ou numéricos, com as duas pontas inclusivas (numa coluna datetime as datas valem pelo dia inteiro) |
|
|
135
135
|
| `orders` | `[{ "pessoa.nome" => "desc" }]` — colunas simples ou de associação |
|
|
136
136
|
|
|
137
137
|
### Colunas array (PostgreSQL)
|
|
@@ -221,6 +221,8 @@ module Huginn
|
|
|
221
221
|
to = parse_datatable_date(to)
|
|
222
222
|
return relation if from.blank? && to.blank?
|
|
223
223
|
|
|
224
|
+
# Dates are compared as whole days: on a datetime column, "to" covers its last day.
|
|
225
|
+
from, to = from&.beginning_of_day, to&.end_of_day if type == :datetime
|
|
224
226
|
relation.where(range_predicate(attr, from, to))
|
|
225
227
|
end
|
|
226
228
|
end
|
data/lib/huginn/version.rb
CHANGED