Permalink
Browse files

include only photos shown in galleries in photo of day, readline gem …

…to stop error on work laptop
  • Loading branch information...
pugetive committed Jan 29, 2019
1 parent 383ca12 commit ced3a4ac6b29db921676984f9ac3687f7c3685ff
Showing with 4 additions and 1 deletion.
  1. +1 −0 Gemfile
  2. +2 −0 Gemfile.lock
  3. +1 −1 app/models/works/photo.rb
@@ -63,6 +63,7 @@ gem 'pdf-reader'
gem 'pundit'
# gem 'rack-cors', require: 'rack/cors'
gem 'rack-mini-profiler', require: false
gem 'rb-readline'
gem 'sitemap_generator'
gem 'whenever', require: false
gem 'wicked_pdf'
@@ -310,6 +310,7 @@ GEM
rb-fsevent (0.10.2)
rb-inotify (0.9.10)
ffi (>= 0.5.0, < 2)
rb-readline (0.5.5)
request_store (1.3.2)
responders (2.4.0)
actionpack (>= 4.2.0, < 5.3)
@@ -462,6 +463,7 @@ DEPENDENCIES
pundit
rack-mini-profiler
rails (= 5.1.4)
rb-readline
rspec-rails
sass-rails
selenium-webdriver
@@ -15,7 +15,7 @@ class Photo < Work


def self.todays_sample_photo
photos = self.where(live: true).sort_by{|photo| Digest::SHA1.hexdigest(photo.id.to_s)}
photos = self.joins(:series_works).uniq.sort_by{|photo| Digest::SHA1.hexdigest(photo.id.to_s)}
days_since_epoch = Date.today.to_time.to_i / (60 * 60 * 24)
photo_index = days_since_epoch % photos.length
photo = photos[photo_index]

0 comments on commit ced3a4a

Please sign in to comment.