Skip to content

Commit

Permalink
Curate yearly cover art
Browse files Browse the repository at this point in the history
  • Loading branch information
jcraigk committed Nov 8, 2024
1 parent 50e5375 commit ee2f864
Showing 1 changed file with 37 additions and 1 deletion.
38 changes: 37 additions & 1 deletion app/api/api_v2/years.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,40 @@
class ApiV2::Years < ApiV2::Base
COVER_ART = {
"1983-1987" => "1983-12-02",
"1988" => "1988-12-10",
"1989" => "1989-10-20",
"1990" => "1990-10-06",
"1991" => "1991-04-04",
"1992" => "1992-03-12",
"1993" => "1993-03-27",
"1994" => "1994-11-25",
"1995" => "1995-12-09",
"1996" => "1996-12-31",
"1997" => "1997-12-31",
"1998" => "1998-11-20",
"1999" => "1999-12-31",
"2000" => "2000-07-10",
"2002" => "2002-12-19",
"2003" => "2003-08-01",
"2004" => "2004-04-15",
"2009" => "2009-08-14",
"2010" => "2010-12-27",
"2011" => "2011-06-30",
"2012" => "2012-06-23",
"2013" => "2013-07-05",
"2014" => "2014-12-31",
"2015" => "2015-07-21",
"2016" => "2016-10-28",
"2017" => "2017-01-13",
"2018" => "2018-12-31",
"2019" => "2019-11-29",
"2020" => "2020-02-20",
"2021" => "2021-09-03",
"2022" => "2022-07-26",
"2023" => "2023-10-06",
"2024" => "2024-10-25"
}

resource :years do
desc "Fetch a list of years" do
detail \
Expand Down Expand Up @@ -43,7 +79,7 @@ def stats_for(period)
else
shows.during_year(period)
end
cover_art_urls = shows.order(date: :desc).first&.cover_art_urls
cover_art_urls = Show.find_by(date: COVER_ART[period]).cover_art_urls
[ shows.count, shows.select(:venue_id).distinct.count, shows.sum(:duration), cover_art_urls ]
end
end
Expand Down

0 comments on commit ee2f864

Please sign in to comment.