Skip to content

Commit 75d3580

Browse files
eraffel-MDSolbethesque
authored andcommitted
fix(index): sort pact publication by date, not string
Use data-text attribute with date converted to integer to properly sort column
1 parent 3ccda93 commit 75d3580

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

lib/pact_broker/ui/view_models/index_item.rb

+4
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,10 @@ def publication_date_of_latest_pact
131131
PactBroker::DateHelper.distance_of_time_in_words(date, DateTime.now) + " ago"
132132
end
133133

134+
def publication_date_of_latest_pact_order
135+
@relationship.latest_pact.created_at.to_time.to_i
136+
end
137+
134138
def verification_status
135139
case @relationship.verification_status
136140
when :success then "success"

lib/pact_broker/ui/views/index/show.haml

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
%a{ href: index_item.provider_group_url }
4343
= escape_html(index_item.provider_name)
4444
%td
45-
%td
45+
%td{"data-text": index_item.publication_date_of_latest_pact_order}
4646
= index_item.publication_date_of_latest_pact
4747
%td{class: index_item.webhook_status}
4848
%a{ href: index_item.webhook_url }

0 commit comments

Comments
 (0)