aesmail / aesmail/kaffy

[FEATURE-REQUEST] custom_index_query should receive all rather than paged

未關閉
#278 1 則留言 0 個 reaction 已指派 1 人 已被 @aesmail 認領 在 GitHub 檢視
enhancement
主要語言
Elixir
星號
1.4k
分支
171
PR 合併指標
30 天內沒有已合併 PR

描述

**Describe the problem you're proposing to solve**

Use of custom_index_query is very limited since it only works on the currently paged view. When you have a custom index query that returns fewer items this issue leads to invalid total numbers and invalid page counts.

**Describe the solution you'd like**

custom_index_query should be used to limit the whole query rather than just the currently paged query, i.e [here](https://github.com/aesmail/kaffy/blob/fc54f1c7b0ef6555d4aad3d352c0dd8cd00a8051/lib/kaffy/resource_query.ex#L29) we should pass all rather than paged, then build the filtered query from there on.

**Describe alternatives you've considered**

Perhaps add a new custom_query instead?

**Additional context**

This type of query breaks records counting and pagination (it shows more pages than there are) work:

```
def custom_index_query(_conn, _schema, query) do
from(r in query, distinct: r.my_custom_field)
end
```

貢獻指南

這個儲存庫沒有索引到貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。