Skip to content

Commit

Permalink
Update old finders (for papyri#271)
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanfb committed Jan 27, 2021
1 parent fa6737d commit 4b875b2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
5 changes: 1 addition & 4 deletions app/models/biblio_identifier.rb
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,7 @@ def xml_title_text
# - temporary identifier name
def self.next_temporary_identifier
year = Time.now.year
latest = self.find(:all,
:conditions => ["name like ?", "papyri.info/#{self::IDENTIFIER_NAMESPACE}/#{year}-%"],
:order => "name DESC",
:limit => 1).first
latest = self.where('name like ?', "papyri.info/#{self::IDENTIFIER_NAMESPACE}/#{year}-%").order(name: :desc).limit(1).first
if latest.nil?
# no constructed id's for this year/class
document_number = 1
Expand Down
5 changes: 1 addition & 4 deletions app/models/cts_identifier.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,7 @@ def self.next_temporary_identifier(collection,template,pubtype,lang)
Rails.logger.info("New urn:#{newUrn}")
document_path = collection + "/" + CTS::CTSLib.pathForUrn(newUrn,pubtype)
editionPart = ".#{self::TEMPORARY_COLLECTION}-#{lang}-#{year}-"
latest = self.find(:all,
:conditions => ["name like ?", "#{document_path}%"],
:order => "name DESC",
:limit => 1).first
latest = self.where('name like ?', "#{document_path}%").order(name: :desc).limit(1).first
if latest.nil?
# no constructed id's for this year/class
document_number = 1
Expand Down

0 comments on commit 4b875b2

Please sign in to comment.