Class: DailyShare::Member
- Inherits:
-
Sequel::Model
- Object
- Sequel::Model
- DailyShare::Member
- Defined in:
- lib/dailyshare/models.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.byEmail(email) ⇒ Object
93 94 95 |
# File 'lib/dailyshare/models.rb', line 93 def self.byEmail(email) self[:email=>email.downcase] end |
.byName(name) ⇒ Object
89 90 91 |
# File 'lib/dailyshare/models.rb', line 89 def self.byName(name) self[:name=>name] end |
Instance Method Details
#missingPhotos ⇒ Object
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 |
# File 'lib/dailyshare/models.rb', line 97 def missingPhotos DB["SELECT date('2012-01-01'::date+(interval '1 day'*s.num)) AS date FROM (SELECT generate_series(0,now()::date-'2012-01-01'::date) AS num) AS s WHERE (SELECT true FROM photos WHERE date_added=date('2012-01-01'::date+(interval '1 day'*s.num)) AND member_id=?) IS null",id] end |
#mostRecentPhoto ⇒ Object
113 114 115 |
# File 'lib/dailyshare/models.rb', line 113 def mostRecentPhoto photos_dataset.order(:date_added.desc).first end |
#submissionByDate(date) ⇒ Object
117 118 119 |
# File 'lib/dailyshare/models.rb', line 117 def submissionByDate(date) photos_dataset.where(:date_added=>date).first end |