mirror of
https://github.com/Growstuff/growstuff.git
synced 2026-05-25 09:19:15 -04:00
Compare commits
15 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8c51d7bdd5 | ||
|
|
64e3b3b4d4 | ||
|
|
978523fd94 | ||
|
|
97f63d1147 | ||
|
|
1a9ff5eb4c | ||
|
|
72b1494db9 | ||
|
|
83bba916a4 | ||
|
|
64179850ff | ||
|
|
33fb2408d6 | ||
|
|
ef4b4d0c46 | ||
|
|
0b5c45d08f | ||
|
|
57bfafccc7 | ||
|
|
2f3e368ede | ||
|
|
3d4598e4e1 | ||
|
|
94db28b3a9 |
@@ -1,20 +1,5 @@
|
||||
class AddDatetakenToPhotos < ActiveRecord::Migration
|
||||
def up
|
||||
def change
|
||||
add_column :photos, :date_taken, :datetime
|
||||
update_flickr_metadata
|
||||
end
|
||||
|
||||
def down
|
||||
add_column :photos, :date_taken
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def update_flickr_metadata
|
||||
# Fetch from flickr, the photos updated the longest ago will be fetched first
|
||||
Photo.all.order(:updated_at).each do |photo|
|
||||
say "Fetch flickr data for #{photo}"
|
||||
photo.set_flickr_metadata!
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -51,7 +51,7 @@ namespace :growstuff do
|
||||
send_on_day = 3 # wednesday
|
||||
every_n_weeks = 2 # send fortnightly
|
||||
|
||||
if Time.zone.today.cwday == send_on_day and Time.zone.today.cweek % every_n_weeks == 0
|
||||
if (Time.zone.today.cwday == send_on_day) && (Time.zone.today.cweek % every_n_weeks == 0)
|
||||
Member.confirmed.find_each do |m|
|
||||
Notifier.planting_reminder(m).deliver_now!
|
||||
end
|
||||
@@ -62,7 +62,7 @@ namespace :growstuff do
|
||||
# this fixes up anyone who has erroneously wound up with a 0,0 lat/long
|
||||
task depopulate_null_island: :environment do
|
||||
Member.find_each do |m|
|
||||
if m.location and (m.latitude.nil? and m.longitude.nil?)
|
||||
if m.location && (m.latitude.nil? && m.longitude.nil?)
|
||||
m.geocode
|
||||
m.save
|
||||
end
|
||||
@@ -88,7 +88,7 @@ namespace :growstuff do
|
||||
# site is small and there aren't many of them, so it shouldn't matter
|
||||
# for this one-off script.
|
||||
Garden.all.each do |g|
|
||||
if g.name.nil? or g.name =~ /^\s*$/
|
||||
if g.name.nil? || g.name =~ /^\s*$/
|
||||
g.name = "Garden"
|
||||
g.save
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user