Skip to content

Instantly share code, notes, and snippets.

@chrishomer
Created May 29, 2014 23:03
Show Gist options
  • Save chrishomer/fdb32e0bc3498aef7aca to your computer and use it in GitHub Desktop.
Save chrishomer/fdb32e0bc3498aef7aca to your computer and use it in GitHub Desktop.
# To try and fix the sort order, switching to an integer instead of time.
integer :listed_at do |item|
original_listed_at_time = nil
original_item = item.original_item if item.original_item_id.present? && item.payout_policy == "upfront"
if original_item && original_item.created_at < Time.parse("April 1 2014")
original_listed_at_time = original_item.listed_at
end
(original_listed_at_time || item.sorting_from || item.listed_at || item.created_at).to_i
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment