Skip to content

Commit

Permalink
Replaced create_date with accession_date for the created accessions r…
Browse files Browse the repository at this point in the history
…eport becuase create_date is when it was added to the database, not when it was accessioned
  • Loading branch information
lmcglohon committed Apr 20, 2017
1 parent 68c1bb3 commit 00e88ae
Showing 1 changed file with 6 additions and 7 deletions.
@@ -1,5 +1,5 @@
class CreatedAccessionsReport < AbstractReport

register_report({
:params => [["from", Date, "The start of report range"],
["to", Date, "The start of report range"]]
Expand All @@ -9,26 +9,25 @@ def initialize(params, job, db)
super
from = params["from"] || Time.now.to_s
to = params["to"] || Time.now.to_s

@from = DateTime.parse(from).to_time.strftime("%Y-%m-%d %H:%M:%S")
@to = DateTime.parse(to).to_time.strftime("%Y-%m-%d %H:%M:%S")

end

def headers
['id', 'identifier', 'title', 'create_date', 'create_time']
['id', 'identifier', 'title', 'accession_date']
end

def processor
{
'identifier' => proc {|record| ASUtils.json_parse(record[:identifier] || "[]").compact.join("-")},
'create_date' => proc {|record| record[:create_time].strftime("%Y-%m-%d")},
'create_time' => proc {|record| record[:create_time].strftime("%H:%M:%S")}
'accession_date' => proc {|record| record[:accession_date].strftime("%Y-%m-%d")},
}
end

def query
db[:accession].where(:create_time => (@from..@to)).order(Sequel.asc(:create_time))
db[:accession].where(:accession_date => (@from..@to)).order(Sequel.asc(:accession_date))
end

end

0 comments on commit 00e88ae

Please sign in to comment.