Skip to content

Commit

Permalink
Re-enable crawling and loosen up limits on Follower Count history mil…
Browse files Browse the repository at this point in the history
…estones [ci skip]
  • Loading branch information
ginatrapani committed May 19, 2012
1 parent e95ef19 commit 1cdcc0a
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 23 deletions.
2 changes: 1 addition & 1 deletion webapp/_lib/model/class.FollowerCountMySQLDAO.php
Expand Up @@ -160,7 +160,7 @@ public function getHistory($network_user_id, $network, $units, $limit=10) {
$milestone['units_of_time'] = $units;
}
//only set milestone if it's within 10 to avoid "954 weeks until you reach 1000 followers" messaging
if ($milestone['will_take'] > 10) {
if ($milestone['will_take'] > 50) {
$milestone = null;
}
} else {
Expand Down
10 changes: 6 additions & 4 deletions webapp/plugins/twitter/model/class.TwitterCrawler.php
Expand Up @@ -1971,13 +1971,14 @@ public function generateInsights() {
$follower_count_history_by_week = $follower_count_dao->getHistory($this->instance->network_user_id,
$this->instance->network, 'WEEK', 5);
if ( isset($follower_count_history_by_week['milestone']) ) {
$insight_text = $follower_count_history_by_week['milestone']['will_take'].' week';
$insight_text = "Upcoming milestone: ";
$insight_text .= $follower_count_history_by_week['milestone']['will_take'].' week';
if ($follower_count_history_by_week['milestone']['will_take'] > 1) {
$insight_text .= 's';
}
$insight_text .= ' till you reach '.
number_format($follower_count_history_by_week['milestone']['next_milestone']);
$insight_text .= ' followers at this rate.';
$insight_text .= ' followers at your current growth rate.';

$insight_date_formatted = $insight_date->format('Y-m-d');
$insight_dao->insertInsight('follower_count_history_by_week_milestone', $this->instance->id,
Expand All @@ -1993,13 +1994,14 @@ public function generateInsights() {
$follower_count_history_by_month = $follower_count_dao->getHistory($this->instance->network_user_id,
$this->instance->network, 'MONTH', 5);
if ( isset($follower_count_history_by_month['milestone']) ) {
$insight_text = $follower_count_history_by_month['milestone']['will_take'].' month';
$insight_text = "Upcoming milestone: ";
$insight_text .= $follower_count_history_by_month['milestone']['will_take'].' month';
if ($follower_count_history_by_month['milestone']['will_take'] > 1) {
$insight_text .= 's';
}
$insight_text .= ' till you reach '.
number_format($follower_count_history_by_month['milestone']['next_milestone']);
$insight_text .= ' followers at this rate.';
$insight_text .= ' followers at your current growth rate.';

$insight_date_formatted = $insight_date->format('Y-m-d');
$insight_dao->insertInsight('follower_count_history_by_month_milestone', $this->instance->id,
Expand Down
36 changes: 18 additions & 18 deletions webapp/plugins/twitter/model/class.TwitterPlugin.php
Expand Up @@ -148,24 +148,24 @@ public function crawl() {
$instance_dao->updateLastRun($instance->id);

// No auth for public Twitter users
// $crawler->fetchInstanceUserTweets();
//
// if (!$noauth) {
// // Auth req'd, for calling user only
// $crawler->fetchInstanceUserMentions();
// $crawler->fetchInstanceUserFriends();
// $crawler->fetchInstanceFavorites();
// $crawler->fetchInstanceUserFollowers();
// $crawler->fetchInstanceUserGroups();
// $crawler->fetchRetweetsOfInstanceUser();
// $crawler->cleanUpMissedFavsUnFavs();
// $crawler->updateStaleGroupMemberships();
// }
//
// $crawler->fetchStrayRepliedToTweets();
// $crawler->fetchUnloadedFollowerDetails();
// $crawler->cleanUpFollows();
// $crawler->fetchFriendTweetsAndFriends();
$crawler->fetchInstanceUserTweets();

if (!$noauth) {
// Auth req'd, for calling user only
$crawler->fetchInstanceUserMentions();
$crawler->fetchInstanceUserFriends();
$crawler->fetchInstanceFavorites();
$crawler->fetchInstanceUserFollowers();
$crawler->fetchInstanceUserGroups();
$crawler->fetchRetweetsOfInstanceUser();
$crawler->cleanUpMissedFavsUnFavs();
$crawler->updateStaleGroupMemberships();
}

$crawler->fetchStrayRepliedToTweets();
$crawler->fetchUnloadedFollowerDetails();
$crawler->cleanUpFollows();
$crawler->fetchFriendTweetsAndFriends();
$crawler->generateInsightBaselines();
$crawler->generateInsights();

Expand Down

0 comments on commit 1cdcc0a

Please sign in to comment.