Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: adrianshort/borisapi
base: 818be65316
...
head fork: adrianshort/borisapi
compare: 3d3955aff3
Checking mergeability… Don't worry, you can still create the pull request.
  • 4 commits
  • 2 files changed
  • 0 commit comments
  • 1 contributor
Showing with 10 additions and 5 deletions.
  1. +1 −1  config.ru
  2. +9 −4 models.rb
View
2  config.ru
@@ -8,5 +8,5 @@ rescue LoadError
Bundler.setup
end
-require 'app'
+require './app'
run Sinatra::Application
View
13 models.rb
@@ -29,11 +29,17 @@ class Station
def self.scrape
set = Setting.first || Setting.create(:stations_last_updated => nil)
- unless set.stations_last_updated.nil? || set.stations_last_updated < DateTime.now - (1 * 60)
-# $stderr.puts "Data updated less than five minutes ago"
+ interval_minutes = 1
+ unless set.stations_last_updated.nil? || set.stations_last_updated.to_time < Time.now - (interval_minutes * 60)
+ $stderr.puts "Data updated less than #{interval_minutes} minutes ago"
return
end
+#
+# $stderr.puts "Last updated: " + set.stations_last_updated.to_s
+# $stderr.puts "Now: " + Time.now.to_s
+# $stderr.puts "Starting scrape"
+
contents = open(MAP_URL).read
# Fetch from local file
@@ -98,8 +104,7 @@ def self.scrape
end
- set.stations_last_updated = Time.now
- set.save
+ set.update('stations_last_updated' => Time.now)
end
end

No commit comments for this range

Something went wrong with that request. Please try again.