lib/osm/giftaid.rb in osm-1.2.22 vs lib/osm/giftaid.rb in osm-1.2.23
- old
+ new
@@ -132,10 +132,12 @@
return response.is_a?(Array)
end
class Donation < Osm::Model
+ SORT_BY = [:donation_date]
+
# @!attribute [rw] donation_date
# @return [Date] When the payment was made
attribute :donation_date, :type => Date
@@ -149,19 +151,16 @@
# @!method initialize
# Initialize a new RegisterField
# @param [Hash] attributes The hash of attributes (see attributes for descriptions, use Symbol of attribute name as the key)
- # Compare Payment based on donation_date then note
- def <=>(another)
- return self.donation_date <=> another.try(:donation_date)
- end
-
end # Class GiftAid::Donation
class Data < Osm::Model
+ SORT_BY = [:section_id, :grouping_id, :last_name, :first_name]
+
# @!attribute [rw] member_id
# @return [Fixnum] The OSM ID for the member
# @!attribute [rw] grouping_id
# @return [Fixnum] The OSM ID for the member's grouping
# @!attribute [rw] section_id
@@ -275,19 +274,9 @@
donations.clean_up! if updated
Osm::Model.cache_delete(api, ['gift_aid_data', section_id, term_id]) if updated
return updated
- end
-
-
- # Compare Data based on section_id, grouping_id, last_name then first_name
- def <=>(another)
- result = self.section_id <=> another.try(:section_id)
- result = self.grouping_id <=> another.try(:grouping_id) if result == 0
- result = self.last_name <=> another.try(:last_name) if result == 0
- result = self.first_name <=> another.try(:last_name) if result == 0
- return result
end
end # Class GiftAid::Data
end # Class GiftAid