Skip to content

Commit

Permalink
Merge pull request #13 from tmooney/add_dates_to_status_tables
Browse files Browse the repository at this point in the history
Add Dates to Status Tables
  • Loading branch information
tmooney authored Aug 11, 2016
2 parents 100339a + 3af6d0c commit df58335
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 5 deletions.
4 changes: 2 additions & 2 deletions app/controllers/models_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ def overview

models_by_type = @models.group_by(&:subclass_name)
statuses = ModelStatusQuery.new( @models.pluck(:genome_model_id) ).execute
@table_items = @models.page(params[:page])
@table_items = @models.order(:creation_date).page(params[:page])

model_status_hash = @table_items.each_with_object({}) do |item, hash|
hash[item.id] = { model: item }
Expand All @@ -26,7 +26,7 @@ def overview

def status
@model = Model.with_statuses_scope.where(genome_model_id: params[:id]).first!
builds = @model.builds
builds = @model.builds.order(:created_at)

@analysis_project = @model.analysis_projects.first

Expand Down
2 changes: 1 addition & 1 deletion app/presenters/build_status_table.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def initialize(builds, view_context)
private
def get_table_items(builds)
builds.map do |build|
StatusTableItem.new(build.id, build.model.name, build.status, build_status_path(id: build.build_id))
StatusTableItem.new(build.id, build.model.name, build.created_at, build.status, build_status_path(id: build.build_id))
end
end
end
2 changes: 1 addition & 1 deletion app/presenters/model_status_table.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def initialize(models_with_status, view_context)
private
def get_table_items(models_with_status)
models_with_status.map do |id, data|
StatusTableItem.new(id, data[:model].name, data[:status], model_status_path(id: id))
StatusTableItem.new(id, data[:model].name, data[:model].creation_date, data[:status], model_status_path(id: id))
end
end
end
2 changes: 1 addition & 1 deletion app/presenters/status_table.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ def initialize(table_name, items)
end
end

class StatusTableItem < Struct.new(:id, :name, :status, :uri)
class StatusTableItem < Struct.new(:id, :name, :date, :status, :uri)
end
3 changes: 3 additions & 0 deletions app/views/shared/_status_table.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,16 @@
%thead
%tr
%th ID
%th Date
%th Status
%th Name
%tbody
- table.items.each do |item|
%tr
%td
= link_to(item.id, item.uri)
%td
= item.date
%td.text-center
= item.status
%td
Expand Down

0 comments on commit df58335

Please sign in to comment.