Skip to content

Commit f29bd90

Browse files
committed
sort printings in release order
1 parent 62995fb commit f29bd90

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

app/resources/card_resource.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,9 @@ class CardResource < ApplicationResource # rubocop:disable Metrics/ClassLength
7575
unless @object.num_extra_faces.zero?
7676
@object.face_indices.each do |index|
7777
f = { index:,
78-
images: images(@object.latest_printing_id, @object.printings.last.xlarge_image?, face_index: index) }
78+
images: images(@object.latest_printing_id,
79+
@object.printings.order(:date_release).reverse_order.first.xlarge_image?,
80+
face_index: index) }
7981
f[:base_link] = @object.faces_base_link[index] if @object.faces_base_link[index]
8082
f[:display_subtypes] = @object.faces_display_subtypes[index] if @object.faces_display_subtypes[index]
8183
f[:card_subtype_ids] = @object.faces_card_subtype_ids[index].compact if @object.faces_card_subtype_ids[index]
@@ -94,7 +96,7 @@ class CardResource < ApplicationResource # rubocop:disable Metrics/ClassLength
9496
attribute :restrictions, :hash
9597
attribute :latest_printing_id, :string
9698
attribute :latest_printing_images, :hash do
97-
images(@object.latest_printing_id, @object.printings.last.xlarge_image?,
99+
images(@object.latest_printing_id, @object.printings.order(:date_release).reverse_order.first.xlarge_image?,
98100
has_narrative_image: @object.narrative_text.present?)
99101
end
100102

0 commit comments

Comments
 (0)