Adds an option for displaying the issue description on the issue list (#3447).

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10948 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2012-12-06 17:48:19 +00:00
parent 43fb321195
commit 8201761e77
12 changed files with 124 additions and 24 deletions

View File

@ -371,12 +371,16 @@ module IssuesHelper
def issues_to_csv(issues, project, query, options={}) def issues_to_csv(issues, project, query, options={})
decimal_separator = l(:general_csv_decimal_separator) decimal_separator = l(:general_csv_decimal_separator)
encoding = l(:general_csv_encoding) encoding = l(:general_csv_encoding)
columns = (options[:columns] == 'all' ? query.available_columns : query.columns) columns = (options[:columns] == 'all' ? query.available_inline_columns : query.inline_columns)
if options[:description]
if description = query.available_columns.detect {|q| q.name == :description}
columns << description
end
end
export = FCSV.generate(:col_sep => l(:general_csv_separator)) do |csv| export = FCSV.generate(:col_sep => l(:general_csv_separator)) do |csv|
# csv header fields # csv header fields
csv << [ "#" ] + columns.collect {|c| Redmine::CodesetUtil.from_utf8(c.caption.to_s, encoding) } + csv << [ "#" ] + columns.collect {|c| Redmine::CodesetUtil.from_utf8(c.caption.to_s, encoding) }
(options[:description] ? [Redmine::CodesetUtil.from_utf8(l(:field_description), encoding)] : [])
# csv lines # csv lines
issues.each do |issue| issues.each do |issue|
@ -398,8 +402,7 @@ module IssuesHelper
end end
s.to_s s.to_s
end end
csv << [ issue.id.to_s ] + col_values.collect {|c| Redmine::CodesetUtil.from_utf8(c.to_s, encoding) } + csv << [ issue.id.to_s ] + col_values.collect {|c| Redmine::CodesetUtil.from_utf8(c.to_s, encoding) }
(options[:description] ? [Redmine::CodesetUtil.from_utf8(issue.description, encoding)] : [])
end end
end end
export export

View File

@ -50,6 +50,14 @@ module QueriesHelper
end end
end end
def available_block_columns_tags(query)
tags = ''.html_safe
query.available_block_columns.each do |column|
tags << content_tag('label', check_box_tag('c[]', column.name.to_s, query.has_column?(column)) + " #{column.caption}", :class => 'inline')
end
tags
end
def column_header(column) def column_header(column)
column.sortable ? sort_header_tag(column.name.to_s, :caption => column.caption, column.sortable ? sort_header_tag(column.name.to_s, :caption => column.caption,
:default_order => column.default_order) : :default_order => column.default_order) :
@ -70,6 +78,8 @@ module QueriesHelper
when 'String' when 'String'
if column.name == :subject if column.name == :subject
link_to(h(value), :controller => 'issues', :action => 'show', :id => issue) link_to(h(value), :controller => 'issues', :action => 'show', :id => issue)
elsif column.name == :description
issue.description? ? content_tag('div', textilizable(issue, :description), :class => "wiki") : ''
else else
h(value) h(value)
end end

View File

@ -27,6 +27,7 @@ class QueryColumn
self.groupable = name.to_s self.groupable = name.to_s
end end
self.default_order = options[:default_order] self.default_order = options[:default_order]
@inline = options.key?(:inline) ? options[:inline] : true
@caption_key = options[:caption] || "field_#{name}" @caption_key = options[:caption] || "field_#{name}"
end end
@ -43,6 +44,10 @@ class QueryColumn
@sortable.is_a?(Proc) ? @sortable.call : @sortable @sortable.is_a?(Proc) ? @sortable.call : @sortable
end end
def inline?
@inline
end
def value(issue) def value(issue)
issue.send name issue.send name
end end
@ -58,6 +63,7 @@ class QueryCustomFieldColumn < QueryColumn
self.name = "cf_#{custom_field.id}".to_sym self.name = "cf_#{custom_field.id}".to_sym
self.sortable = custom_field.order_statement || false self.sortable = custom_field.order_statement || false
self.groupable = custom_field.group_statement || false self.groupable = custom_field.group_statement || false
@inline = true
@cf = custom_field @cf = custom_field
end end
@ -153,7 +159,8 @@ class Query < ActiveRecord::Base
QueryColumn.new(:estimated_hours, :sortable => "#{Issue.table_name}.estimated_hours"), QueryColumn.new(:estimated_hours, :sortable => "#{Issue.table_name}.estimated_hours"),
QueryColumn.new(:done_ratio, :sortable => "#{Issue.table_name}.done_ratio", :groupable => true), QueryColumn.new(:done_ratio, :sortable => "#{Issue.table_name}.done_ratio", :groupable => true),
QueryColumn.new(:created_on, :sortable => "#{Issue.table_name}.created_on", :default_order => 'desc'), QueryColumn.new(:created_on, :sortable => "#{Issue.table_name}.created_on", :default_order => 'desc'),
QueryColumn.new(:relations, :caption => :label_related_issues) QueryColumn.new(:relations, :caption => :label_related_issues),
QueryColumn.new(:description, :inline => false)
] ]
cattr_reader :available_columns cattr_reader :available_columns
@ -506,6 +513,22 @@ class Query < ActiveRecord::Base
end.compact end.compact
end end
def inline_columns
columns.select(&:inline?)
end
def block_columns
columns.reject(&:inline?)
end
def available_inline_columns
available_columns.select(&:inline?)
end
def available_block_columns
available_columns.reject(&:inline?)
end
def default_columns_names def default_columns_names
@default_columns_names ||= begin @default_columns_names ||= begin
default_columns = Setting.issue_list_default_columns.map(&:to_sym) default_columns = Setting.issue_list_default_columns.map(&:to_sym)

View File

@ -10,7 +10,7 @@
:title => "#{l(:button_check_all)}/#{l(:button_uncheck_all)}" %> :title => "#{l(:button_check_all)}/#{l(:button_uncheck_all)}" %>
</th> </th>
<%= sort_header_tag('id', :caption => '#', :default_order => 'desc') %> <%= sort_header_tag('id', :caption => '#', :default_order => 'desc') %>
<% query.columns.each do |column| %> <% query.inline_columns.each do |column| %>
<%= column_header(column) %> <%= column_header(column) %>
<% end %> <% end %>
</tr> </tr>
@ -21,7 +21,7 @@
<% if @query.grouped? && (group = @query.group_by_column.value(issue)) != previous_group %> <% if @query.grouped? && (group = @query.group_by_column.value(issue)) != previous_group %>
<% reset_cycle %> <% reset_cycle %>
<tr class="group open"> <tr class="group open">
<td colspan="<%= query.columns.size + 2 %>"> <td colspan="<%= query.inline_columns.size + 2 %>">
<span class="expander" onclick="toggleRowGroup(this);">&nbsp;</span> <span class="expander" onclick="toggleRowGroup(this);">&nbsp;</span>
<%= group.blank? ? l(:label_none) : column_content(@query.group_by_column, issue) %> <span class="count"><%= @issue_count_by_group[group] %></span> <%= group.blank? ? l(:label_none) : column_content(@query.group_by_column, issue) %> <span class="count"><%= @issue_count_by_group[group] %></span>
<%= link_to_function("#{l(:button_collapse_all)}/#{l(:button_expand_all)}", <%= link_to_function("#{l(:button_collapse_all)}/#{l(:button_expand_all)}",
@ -33,8 +33,15 @@
<tr id="issue-<%= issue.id %>" class="hascontextmenu <%= cycle('odd', 'even') %> <%= issue.css_classes %> <%= level > 0 ? "idnt idnt-#{level}" : nil %>"> <tr id="issue-<%= issue.id %>" class="hascontextmenu <%= cycle('odd', 'even') %> <%= issue.css_classes %> <%= level > 0 ? "idnt idnt-#{level}" : nil %>">
<td class="checkbox hide-when-print"><%= check_box_tag("ids[]", issue.id, false, :id => nil) %></td> <td class="checkbox hide-when-print"><%= check_box_tag("ids[]", issue.id, false, :id => nil) %></td>
<td class="id"><%= link_to issue.id, issue_path(issue) %></td> <td class="id"><%= link_to issue.id, issue_path(issue) %></td>
<%= raw query.columns.map {|column| "<td class=\"#{column.css_classes}\">#{column_content(column, issue)}</td>"}.join %> <%= raw query.inline_columns.map {|column| "<td class=\"#{column.css_classes}\">#{column_content(column, issue)}</td>"}.join %>
</tr> </tr>
<% @query.block_columns.each do |column|
if (text = column_content(column, issue)) && text.present? -%>
<tr class="<%= current_cycle %>">
<td colspan="<%= @query.inline_columns.size + 2 %>" class="<%= column.css_classes %>"><%= text %></td>
</tr>
<% end -%>
<% end -%>
<% end -%> <% end -%>
</tbody> </tbody>
</table> </table>

View File

@ -34,6 +34,10 @@
@query.group_by) @query.group_by)
) %></td> ) %></td>
</tr> </tr>
<tr>
<td><%= l(:button_show) %></td>
<td><%= available_block_columns_tags(@query) %></td>
</tr>
</table> </table>
</div> </div>
</fieldset> </fieldset>
@ -73,7 +77,7 @@
<label><%= radio_button_tag 'columns', 'all' %> <%= l(:description_all_columns) %></label> <label><%= radio_button_tag 'columns', 'all' %> <%= l(:description_all_columns) %></label>
</p> </p>
<p> <p>
<label><%= check_box_tag 'description', '1' %> <%= l(:field_description) %></label> <label><%= check_box_tag 'description', '1', @query.has_column?(:description) %> <%= l(:field_description) %></label>
</p> </p>
<p class="buttons"> <p class="buttons">
<%= submit_tag l(:button_export), :name => nil, :onclick => "hideModal(this);" %> <%= submit_tag l(:button_export), :name => nil, :onclick => "hideModal(this);" %>

View File

@ -4,7 +4,7 @@
<%= label_tag "available_columns", l(:description_available_columns) %> <%= label_tag "available_columns", l(:description_available_columns) %>
<br /> <br />
<%= select_tag 'available_columns', <%= select_tag 'available_columns',
options_for_select((query.available_columns - query.columns).collect {|column| [column.caption, column.name]}), options_for_select((query.available_inline_columns - query.columns).collect {|column| [column.caption, column.name]}),
:multiple => true, :size => 10, :style => "width:150px", :multiple => true, :size => 10, :style => "width:150px",
:ondblclick => "moveOptions(this.form.available_columns, this.form.selected_columns);" %> :ondblclick => "moveOptions(this.form.available_columns, this.form.selected_columns);" %>
</td> </td>
@ -18,7 +18,7 @@
<%= label_tag "selected_columns", l(:description_selected_columns) %> <%= label_tag "selected_columns", l(:description_selected_columns) %>
<br /> <br />
<%= select_tag((defined?(tag_name) ? tag_name : 'c[]'), <%= select_tag((defined?(tag_name) ? tag_name : 'c[]'),
options_for_select(query.columns.collect {|column| [column.caption, column.name]}), options_for_select(query.inline_columns.collect {|column| [column.caption, column.name]}),
:id => 'selected_columns', :multiple => true, :size => 10, :style => "width:150px", :id => 'selected_columns', :multiple => true, :size => 10, :style => "width:150px",
:ondblclick => "moveOptions(this.form.selected_columns, this.form.available_columns);") %> :ondblclick => "moveOptions(this.form.selected_columns, this.form.available_columns);") %>
</td> </td>

View File

@ -21,6 +21,9 @@
<p><label for="query_group_by"><%= l(:field_group_by) %></label> <p><label for="query_group_by"><%= l(:field_group_by) %></label>
<%= select 'query', 'group_by', @query.groupable_columns.collect {|c| [c.caption, c.name.to_s]}, :include_blank => true %></p> <%= select 'query', 'group_by', @query.groupable_columns.collect {|c| [c.caption, c.name.to_s]}, :include_blank => true %></p>
<p><label><%= l(:button_show) %></label>
<%= available_block_columns_tags(@query) %></p>
</div> </div>
<fieldset id="filters"><legend><%= l(:label_filter_plural) %></legend> <fieldset id="filters"><legend><%= l(:label_filter_plural) %></legend>

View File

@ -403,6 +403,9 @@ class TCPDF
Error("Incorrect orientation: #{orientation}") Error("Incorrect orientation: #{orientation}")
end end
@fw = @w_pt/@k
@fh = @h_pt/@k
@cur_orientation = @def_orientation @cur_orientation = @def_orientation
@w = @w_pt/@k @w = @w_pt/@k
@h = @h_pt/@k @h = @h_pt/@k
@ -3615,9 +3618,9 @@ class TCPDF
restspace = GetPageHeight() - GetY() - GetBreakMargin(); restspace = GetPageHeight() - GetY() - GetBreakMargin();
writeHTML(html, true, fill); # write html text writeHTML(html, true, fill); # write html text
SetX(x)
currentY = GetY(); currentY = GetY();
@auto_page_break = false; @auto_page_break = false;
# check if a new page has been created # check if a new page has been created
if (@page > pagenum) if (@page > pagenum)
@ -3625,11 +3628,13 @@ class TCPDF
currentpage = @page; currentpage = @page;
@page = pagenum; @page = pagenum;
SetY(GetPageHeight() - restspace - GetBreakMargin()); SetY(GetPageHeight() - restspace - GetBreakMargin());
SetX(x)
Cell(w, restspace - 1, "", b, 0, 'L', 0); Cell(w, restspace - 1, "", b, 0, 'L', 0);
b = b2; b = b2;
@page += 1; @page += 1;
while @page < currentpage while @page < currentpage
SetY(@t_margin); # put cursor at the beginning of text SetY(@t_margin); # put cursor at the beginning of text
SetX(x)
Cell(w, @page_break_trigger - @t_margin, "", b, 0, 'L', 0); Cell(w, @page_break_trigger - @t_margin, "", b, 0, 'L', 0);
@page += 1; @page += 1;
end end
@ -3638,10 +3643,12 @@ class TCPDF
end end
# design a cell around the text on last page # design a cell around the text on last page
SetY(@t_margin); # put cursor at the beginning of text SetY(@t_margin); # put cursor at the beginning of text
SetX(x)
Cell(w, currentY - @t_margin, "", b, 0, 'L', 0); Cell(w, currentY - @t_margin, "", b, 0, 'L', 0);
else else
SetY(y); # put cursor at the beginning of text SetY(y); # put cursor at the beginning of text
# design a cell around the text # design a cell around the text
SetX(x)
Cell(w, [h, (currentY - y)].max, "", border, 0, 'L', 0); Cell(w, [h, (currentY - y)].max, "", border, 0, 'L', 0);
end end
@auto_page_break = true; @auto_page_break = true;

View File

@ -34,12 +34,12 @@ module Redmine
include Redmine::I18n include Redmine::I18n
attr_accessor :footer_date attr_accessor :footer_date
def initialize(lang) def initialize(lang, orientation='P')
@@k_path_cache = Rails.root.join('tmp', 'pdf') @@k_path_cache = Rails.root.join('tmp', 'pdf')
FileUtils.mkdir_p @@k_path_cache unless File::exist?(@@k_path_cache) FileUtils.mkdir_p @@k_path_cache unless File::exist?(@@k_path_cache)
set_language_if_valid lang set_language_if_valid lang
pdf_encoding = l(:general_pdf_encoding).upcase pdf_encoding = l(:general_pdf_encoding).upcase
super('P', 'mm', 'A4', (pdf_encoding == 'UTF-8'), pdf_encoding) super(orientation, 'mm', 'A4', (pdf_encoding == 'UTF-8'), pdf_encoding)
case current_language.to_s.downcase case current_language.to_s.downcase
when 'vi' when 'vi'
@font_for_content = 'DejaVuSans' @font_for_content = 'DejaVuSans'
@ -236,7 +236,7 @@ module Redmine
# fetch row values # fetch row values
def fetch_row_values(issue, query, level) def fetch_row_values(issue, query, level)
query.columns.collect do |column| query.inline_columns.collect do |column|
s = if column.is_a?(QueryCustomFieldColumn) s = if column.is_a?(QueryCustomFieldColumn)
cv = issue.custom_field_values.detect {|v| v.custom_field_id == column.custom_field.id} cv = issue.custom_field_values.detect {|v| v.custom_field_id == column.custom_field.id}
show_value(cv) show_value(cv)
@ -263,10 +263,10 @@ module Redmine
# by captions # by captions
pdf.SetFontStyle('B',8) pdf.SetFontStyle('B',8)
col_padding = pdf.GetStringWidth('OO') col_padding = pdf.GetStringWidth('OO')
col_width_min = query.columns.map {|v| pdf.GetStringWidth(v.caption) + col_padding} col_width_min = query.inline_columns.map {|v| pdf.GetStringWidth(v.caption) + col_padding}
col_width_max = Array.new(col_width_min) col_width_max = Array.new(col_width_min)
col_width_avg = Array.new(col_width_min) col_width_avg = Array.new(col_width_min)
word_width_max = query.columns.map {|c| word_width_max = query.inline_columns.map {|c|
n = 10 n = 10
c.caption.split.each {|w| c.caption.split.each {|w|
x = pdf.GetStringWidth(w) + col_padding x = pdf.GetStringWidth(w) + col_padding
@ -370,13 +370,13 @@ module Redmine
# render it background to find the max height used # render it background to find the max height used
base_x = pdf.GetX base_x = pdf.GetX
base_y = pdf.GetY base_y = pdf.GetY
max_height = issues_to_pdf_write_cells(pdf, query.columns, col_width, row_height, true) max_height = issues_to_pdf_write_cells(pdf, query.inline_columns, col_width, row_height, true)
pdf.Rect(base_x, base_y, table_width + col_id_width, max_height, 'FD'); pdf.Rect(base_x, base_y, table_width + col_id_width, max_height, 'FD');
pdf.SetXY(base_x, base_y); pdf.SetXY(base_x, base_y);
# write the cells on page # write the cells on page
pdf.RDMCell(col_id_width, row_height, "#", "T", 0, 'C', 1) pdf.RDMCell(col_id_width, row_height, "#", "T", 0, 'C', 1)
issues_to_pdf_write_cells(pdf, query.columns, col_width, row_height, true) issues_to_pdf_write_cells(pdf, query.inline_columns, col_width, row_height, true)
issues_to_pdf_draw_borders(pdf, base_x, base_y, base_y + max_height, col_id_width, col_width) issues_to_pdf_draw_borders(pdf, base_x, base_y, base_y + max_height, col_id_width, col_width)
pdf.SetY(base_y + max_height); pdf.SetY(base_y + max_height);
@ -387,7 +387,7 @@ module Redmine
# Returns a PDF string of a list of issues # Returns a PDF string of a list of issues
def issues_to_pdf(issues, project, query) def issues_to_pdf(issues, project, query)
pdf = ITCPDF.new(current_language) pdf = ITCPDF.new(current_language, "L")
title = query.new_record? ? l(:label_issue_plural) : query.name title = query.new_record? ? l(:label_issue_plural) : query.name
title = "#{project} - #{title}" if project title = "#{project} - #{title}" if project
pdf.SetTitle(title) pdf.SetTitle(title)
@ -407,11 +407,17 @@ module Redmine
# column widths # column widths
table_width = page_width - right_margin - 10 # fixed left margin table_width = page_width - right_margin - 10 # fixed left margin
col_width = [] col_width = []
unless query.columns.empty? unless query.inline_columns.empty?
col_width = calc_col_width(issues, query, table_width - col_id_width, pdf) col_width = calc_col_width(issues, query, table_width - col_id_width, pdf)
table_width = col_width.inject(0) {|s,v| s += v} table_width = col_width.inject(0) {|s,v| s += v}
end end
# use full width if the description is displayed
if table_width > 0 && query.has_column?(:description)
col_width = col_width.map {|w| w = w * (page_width - right_margin - 10 - col_id_width) / table_width}
table_width = col_width.inject(0) {|s,v| s += v}
end
# title # title
pdf.SetFontStyle('B',11) pdf.SetFontStyle('B',11)
pdf.RDMCell(190,10, title) pdf.RDMCell(190,10, title)
@ -454,6 +460,13 @@ module Redmine
issues_to_pdf_write_cells(pdf, col_values, col_width, row_height) issues_to_pdf_write_cells(pdf, col_values, col_width, row_height)
issues_to_pdf_draw_borders(pdf, base_x, base_y, base_y + max_height, col_id_width, col_width) issues_to_pdf_draw_borders(pdf, base_x, base_y, base_y + max_height, col_id_width, col_width)
pdf.SetY(base_y + max_height); pdf.SetY(base_y + max_height);
if query.has_column?(:description) && issue.description?
pdf.SetX(10)
pdf.SetAutoPageBreak(true, 20)
pdf.RDMwriteHTMLCell(0, 5, 10, 0, issue.description.to_s, issue.attachments, "LRBT")
pdf.SetAutoPageBreak(false)
end
end end
if issues.size == Setting.issues_export_limit.to_i if issues.size == Setting.issues_export_limit.to_i

View File

@ -149,6 +149,8 @@ tr.issue td.subject, tr.issue td.category, td.assigned_to, tr.issue td.string, t
tr.issue td.subject, tr.issue td.relations { text-align: left; } tr.issue td.subject, tr.issue td.relations { text-align: left; }
tr.issue td.done_ratio table.progress { margin-left:auto; margin-right: auto;} tr.issue td.done_ratio table.progress { margin-left:auto; margin-right: auto;}
tr.issue td.relations span {white-space: nowrap;} tr.issue td.relations span {white-space: nowrap;}
table.issues td.description {color:#777; font-size:90%; padding:4px 4px 4px 24px; text-align:left; white-space:normal;}
table.issues td.description pre {white-space:normal;}
tr.issue.idnt td.subject a {background: url(../images/bullet_arrow_right.png) no-repeat 0 50%; padding-left: 16px;} tr.issue.idnt td.subject a {background: url(../images/bullet_arrow_right.png) no-repeat 0 50%; padding-left: 16px;}
tr.issue.idnt-1 td.subject {padding-left: 0.5em;} tr.issue.idnt-1 td.subject {padding-left: 0.5em;}

View File

@ -418,7 +418,7 @@ class IssuesControllerTest < ActionController::TestCase
assert_equal 'text/csv; header=present', @response.content_type assert_equal 'text/csv; header=present', @response.content_type
assert @response.body.starts_with?("#,") assert @response.body.starts_with?("#,")
lines = @response.body.chomp.split("\n") lines = @response.body.chomp.split("\n")
assert_equal assigns(:query).available_columns.size + 1, lines[0].split(',').size assert_equal assigns(:query).available_inline_columns.size + 1, lines[0].split(',').size
end end
def test_index_csv_with_multi_column_field def test_index_csv_with_multi_column_field
@ -825,6 +825,17 @@ class IssuesControllerTest < ActionController::TestCase
assert_equal 'application/pdf', response.content_type assert_equal 'application/pdf', response.content_type
end end
def test_index_with_description_column
get :index, :set_filter => 1, :c => %w(subject description)
assert_select 'table.issues thead th', 3 # columns: chekbox + id + subject
assert_select 'td.description[colspan=3]', :text => 'Unable to print recipes'
get :index, :set_filter => 1, :c => %w(subject description), :format => 'pdf'
assert_response :success
assert_equal 'application/pdf', response.content_type
end
def test_index_send_html_if_query_is_invalid def test_index_send_html_if_query_is_invalid
get :index, :f => ['start_date'], :op => {:start_date => '='} get :index, :f => ['start_date'], :op => {:start_date => '='}
assert_equal 'text/html', @response.content_type assert_equal 'text/html', @response.content_type

View File

@ -737,7 +737,9 @@ class QueryTest < ActiveSupport::TestCase
def test_default_columns def test_default_columns
q = Query.new q = Query.new
assert !q.columns.empty? assert q.columns.any?
assert q.inline_columns.any?
assert q.block_columns.empty?
end end
def test_set_column_names def test_set_column_names
@ -748,6 +750,21 @@ class QueryTest < ActiveSupport::TestCase
assert q.has_column?(c) assert q.has_column?(c)
end end
def test_inline_and_block_columns
q = Query.new
q.column_names = ['subject', 'description', 'tracker']
assert_equal [:subject, :tracker], q.inline_columns.map(&:name)
assert_equal [:description], q.block_columns.map(&:name)
end
def test_custom_field_columns_should_be_inline
q = Query.new
columns = q.available_columns.select {|column| column.is_a? QueryCustomFieldColumn}
assert columns.any?
assert_nil columns.detect {|column| !column.inline?}
end
def test_query_should_preload_spent_hours def test_query_should_preload_spent_hours
q = Query.new(:name => '_', :column_names => [:subject, :spent_hours]) q = Query.new(:name => '_', :column_names => [:subject, :spent_hours])
assert q.has_column?(:spent_hours) assert q.has_column?(:spent_hours)