Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <blockquote> <p>Also, it would be cool, if the column "Spent time" was sortable.</p> </blockquote> <p>After looking up the produced SQL, I just implemented the sortable feature this in this way:</p> <pre><code>base.add_available_column(QueryColumn.new(:spent_hours, :sortable =&gt; "(select sum(hours) from time_entries where time_entries.issue_id = t0_r0)") ) </code></pre> <p>Replace the respective line. I just hope the issue_id column's name is always "t0_r0" ...</p> <p>PS: You can find lots of examples in app/models/query.rb lines 122++</p> <p><strong>2-Digits Problem:</strong> Unfortunatly, I had to hack one of the core files: app/helpers/queries_helper.rb</p> <p>Around line 44, change this:</p> <pre><code>when 'Fixnum', 'Float' if column.name == :done_ratio progress_bar(value, :width =&gt; '80px') else value.to_s end </code></pre> <p>into:</p> <pre><code>when 'Fixnum', 'Float' if column.name == :done_ratio progress_bar(value, :width =&gt; '80px') elsif column.name == :spent_hours sprintf "%.2f", value else value.to_s end </code></pre> <p><strong>EDIT: Using a patch instead manipulating the source</strong> Recently, we did an update of the redmine system, so the above mentioned Fix also was removed. This time, we decided to implement that as a patch.</p> <p>Open up any plugin (We created a plugin for our monkey-patch changes on core). open up vendor/plugins/redmine_YOURPLUGIN/app/helpers/queries_helper.rb</p> <pre class="lang-ruby prettyprint-override"><code>module QueriesHelper def new_column_content(column, issue) value = column.value(issue) if value.class.name == "Float" and column.name == :spent_hours sprintf "%.2f", value else __column_content(column, issue) end end alias_method :__column_content, :column_content alias_method :column_content, :new_column_content end </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload