Created
December 5, 2015 02:09
-
-
Save mahcloud/1dac784319cb5be341cd to your computer and use it in GitHub Desktop.
rss job
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def self.perform(rss_feed_id, rss_import_id) | |
| rss_feed = RssFeed.find(rss_feed_id) | |
| rss_feed.run(rss_import_id) | |
| rss_import = RssImport.find(rss_import_id) | |
| firebase = Firebase::Client.new(ENV['FIREBASE_URL']) | |
| json = { | |
| rss_feed.state_abbr.to_sym => { | |
| fillKey: rss_feed.map_color(rss_import.id), | |
| articles_count: rss_import.rss_articles.where(rss_feed_id: rss_feed.id).count, | |
| finished_articles_count: rss_import.rss_articles.where(rss_feed_id: rss_feed.id).where(finished: true).count | |
| } | |
| } | |
| firebase.update('rss_map', json) | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment