Show movies watched on weekly posts

This commit is contained in:
2023-05-13 12:45:31 +10:00
parent f613717852
commit bcaab0754a
12 changed files with 101 additions and 28 deletions

View File

@@ -10,6 +10,24 @@ module Adamantium
def by_title_and_year(title:, year:)
movies.where(title: title, year: year).one
end
def from_the_archives(start_date:, end_date:)
# SELECT * FROM posts
# WHERE EXTRACT(month FROM "published_at") >= 2
# WHERE EXTRACT(month FROM "published_at") <= 2+
# AND EXTRACT(day FROM "published_at") > 20
# AND EXTRACT(day FROM "published_at") < 27
# AND post_type = 'post';
movies
.where { Sequel.extract(:year, :watched_at) >= start_date.year }
.where { Sequel.extract(:year, :watched_at) <= start_date.year }
.where { Sequel.extract(:month, :watched_at) >= start_date.month }
.where { Sequel.extract(:month, :watched_at) <= end_date.month }
.where { Sequel.extract(:day, :watched_at) >= start_date.day }
.where { Sequel.extract(:day, :watched_at) <= end_date.day }
.to_a
end
end
end
end