Commit f31ffbd442f82645bc987b1028e56c382d01ba14
1 parent
fe22425a
Exists in
theme-brasil-digital-from-staging
and in
9 other branches
change monitor variable to created time
Showing
1 changed file
with
12 additions
and
2 deletions
Show diff stats
plugins/community_hub/facebook_stream/codfish_facebook_api.rb
... | ... | @@ -27,6 +27,7 @@ end |
27 | 27 | extractedComments = [] |
28 | 28 | initialComments = [] |
29 | 29 | firstTime = true |
30 | +read = 1 | |
30 | 31 | |
31 | 32 | while true |
32 | 33 | file = open("https://graph.facebook.com/v1.0/search?q=%23#{hashtag}&type=post&access_token=#{token}") |
... | ... | @@ -41,8 +42,8 @@ while true |
41 | 42 | message += i['message'] |
42 | 43 | end |
43 | 44 | if not_blank(message) |
44 | - if mostRecent == "" or mostRecent < i["updated_time"] | |
45 | - mostRecent = i["updated_time"] | |
45 | + if mostRecent == "" or mostRecent < i["created_time"] | |
46 | + mostRecent = i["created_time"] | |
46 | 47 | end |
47 | 48 | |
48 | 49 | extractedComments.push("#{from} said: #{message}") |
... | ... | @@ -61,6 +62,11 @@ while true |
61 | 62 | # puts comment |
62 | 63 | # } |
63 | 64 | |
65 | +# extractedComments.each{|comment| | |
66 | +# puts comment | |
67 | +# } | |
68 | + | |
69 | + | |
64 | 70 | newComments = extractedComments - initialComments |
65 | 71 | newComments = newComments.uniq |
66 | 72 | initialComments += newComments |
... | ... | @@ -68,7 +74,11 @@ while true |
68 | 74 | newComments.each{|comment| |
69 | 75 | puts comment |
70 | 76 | } |
77 | + puts "****************************************************************************************************************" | |
71 | 78 | puts "most recent post at #{mostRecent}" |
79 | + puts "Read: #{read} newComments: #{newComments.length} initialComments: #{initialComments.length} extractedComments: #{extractedComments.length} *******" | |
80 | + | |
81 | + read+=1 | |
72 | 82 | sleep(pooling_time) |
73 | 83 | end |
74 | 84 | ... | ... |