プロジェクト

全般

プロフィール

Vote #76473

未完了

Query option, The sql for field to allow groups option.

Admin Redmine さんが約2年前に追加.

ステータス:
New
優先度:
高め
担当者:
-
カテゴリ:
-
対象バージョン:
-
開始日:
2022/05/09
期日:
進捗率:

0%

予定工数:
category_id:
0
version_id:
0
issue_org_id:
20124
author_id:
84718
assigned_to_id:
0
comments:
6
status_id:
1
tracker_id:
3
plus1:
0
affected_version:
closed_on:
affected_version_id:
ステータス-->[New]

説明

The simple commit help abundantly and allow us to grouping the custom queries.
When the available filters is added with the field name, the check already exists for sql field statement.
Another check is added when the field is added with grouping.

Please update this patch in the core.

Thanks.


journals

The advantage of this patch, is that I do not need to alias the sql_for_field method in my plugin!
I am also open for more elegant solution.
Thanks.
--------------------------------------------------------------------------------
Where is @$2@ from?
@field =~ /^(.+)\./@ returns only @$1@.
--------------------------------------------------------------------------------
For the below cases, With grouping of filters,

Suppose, If I add a custom filter through a plugin patch
<pre><code class="ruby">
add_available_filter("question.qassigned_to_id", :type => :list, :values => author_values,
:caption => :field_question_assigned_to_id, :name => l(:field_question_assigned_to_id_esi)
)
</code></pre>

The only way to handle the corresponding SQL query is to alias the sql_for_field.
Instead if the attached patch is provided,
I can avoid the alias and also have my method,

<pre><code class="ruby">
def sql_for_qassigned_to_id_field(.....)
.... sql logic...
end
</code></pre>

Thank You.
--------------------------------------------------------------------------------
In your attachment:sql_for_fields_with_group-git.diff

<pre><code class="ruby">
elsif field =~ /^(.+)\./ && respond_to?("sql_for_#{$2}_field")
# specific statement
filters_clauses << send("sql_for_#{$2}_field", field, operator, v)
</code></pre>

http://ruby-doc.org/core-2.1.1/Regexp.html#class-Regexp-label-Special+global+variables
> $1, $2 and so on contain text matching first, second, etc capture group;

But your @field =~ /^(.+)\./@ has only one parenthesis.
--------------------------------------------------------------------------------
Yes, Realized my mistake. Thank You.
Here is the Updated patch.

Thanks.
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------

表示するデータがありません

他の形式にエクスポート: Atom PDF

いいね!0