Skip to content

Commit

Permalink
Tweak insight labels and emphasis [ci skip]
Browse files Browse the repository at this point in the history
  • Loading branch information
ginatrapani committed Aug 27, 2012
1 parent c7483e5 commit 74f5f65
Show file tree
Hide file tree
Showing 9 changed files with 23 additions and 25 deletions.
2 changes: 1 addition & 1 deletion webapp/_lib/view/_insights.posts.tpl
Expand Up @@ -19,7 +19,7 @@

{* Show "X years ago you posted" text if post is from a different year than the last one *}
{if !$smarty.foreach.bar.first and $prev_post_year neq $p->adj_pub_date|date_format:"%Y"}
<div style="margin-top : 12px;"><span class="label label-info"><i class="icon-white icon-time"></i> {$p->adj_pub_date|date_format:"%Y"} Flashback:</span> {$p->adj_pub_date|relative_datetime} ago, you posted:</div>
<div style="margin-top : 12px;"><!--<span class="label label-info"><i class="icon-white icon-time"></i> {$p->adj_pub_date|date_format:"%Y"} flashback:</span>--> {$p->adj_pub_date|relative_datetime} ago, you posted:</div>
{/if}

{include file="_insights.post.tpl" post=$p hide_insight_header='1'}
Expand Down
4 changes: 2 additions & 2 deletions webapp/plugins/insightsgenerator/insights/biggestfans.php
Expand Up @@ -52,7 +52,7 @@ public function generateInsight(Instance $instance, $last_week_of_posts, $number
if (isset($fans) && sizeof($fans) > 0 ) {
$this->insight_dao->insertInsight("biggest_fans_last_30_days", $instance->id,
$since_date, "Biggest fans:", "People who liked your posts the most over the last 30 days: ",
Insight::EMPHASIS_MED, serialize($fans));
Insight::EMPHASIS_LOW, serialize($fans));
}
}
} else if ($insight_day_of_week == 0) { //it's Sunday
Expand All @@ -66,7 +66,7 @@ public function generateInsight(Instance $instance, $last_week_of_posts, $number
if (isset($fans) && sizeof($fans) > 0 ) {
$this->insight_dao->insertInsight("biggest_fans_last_7_days", $instance->id,
$since_date, "Biggest fans:", "People who liked your posts the most over the last 7 days: ",
Insight::EMPHASIS_MED, serialize($fans));
Insight::EMPHASIS_LOW, serialize($fans));
}
}
}
Expand Down
Expand Up @@ -48,7 +48,7 @@ public function generateInsight(Instance $instance, $last_week_of_posts, $number
if (isset($flashback_favs) && sizeof($flashback_favs) > 0 ) {
$this->insight_dao->insertInsight("favorites_year_ago_flashback", $instance->id,
$since_date, "Stuff you liked:", "On this day in years past, you liked: ",
Insight::EMPHASIS_MED, serialize($flashback_favs));
Insight::EMPHASIS_LOW, serialize($flashback_favs));
}
}
$days_ago++;
Expand Down
2 changes: 1 addition & 1 deletion webapp/plugins/insightsgenerator/insights/flashbacks.php
Expand Up @@ -48,7 +48,7 @@ public function generateInsight(Instance $instance, $last_week_of_posts, $number
$number_of_years_ago = $current_year - $oldest_post_year;
$plural = ($number_of_years_ago > 1 )?'s':'';
$this->insight_dao->insertInsight("posts_on_this_day_flashback", $instance->id,
$this->insight_date, $oldest_post_year." flashback:", $number_of_years_ago." year".
$this->insight_date, "Time machine:", $number_of_years_ago." year".
$plural. " ago today, you posted: ", Insight::EMPHASIS_MED, serialize($flashback_posts));
}
}
Expand Down
Expand Up @@ -59,7 +59,7 @@ public function generateInsight(Instance $instance, $last_week_of_posts, $number
$insight_text .= '</strong> followers at your current growth rate.';

$this->insight_dao->insertInsight('follower_count_history_by_month_milestone', $instance->id,
$this->insight_date, "Upcoming milestone:", $insight_text, Insight::EMPHASIS_HIGH,
$this->insight_date, "Upcoming milestone:", $insight_text, Insight::EMPHASIS_LOW,
serialize($follower_count_history_by_month));
}
} else if ($insight_day_of_week == 0) { //it's Sunday
Expand All @@ -85,7 +85,7 @@ public function generateInsight(Instance $instance, $last_week_of_posts, $number
.__LINE__);

$this->insight_dao->insertInsight('follower_count_history_by_week_milestone', $instance->id,
$this->insight_date, "Upcoming milestone:", $insight_text, Insight::EMPHASIS_HIGH,
$this->insight_date, "Upcoming milestone:", $insight_text, Insight::EMPHASIS_LOW,
serialize($follower_count_history_by_week));
}
}
Expand Down
Expand Up @@ -43,20 +43,20 @@ public function generateInsight(Instance $instance, $last_week_of_posts, $number

if (sizeof($least_likely_followers) > 0 ) { //if not null, store insight
//If followers have more followers than half of what the instance has, jack up emphasis
$emphasis = Insight::EMPHASIS_LOW;
foreach ($least_likely_followers as $least_likely_follower) {
if ($least_likely_follower->follower_count > ($this->user->follower_count/2)) {
$emphasis = Insight::EMPHASIS_HIGH;
$emphasis = Insight::EMPHASIS_LOW;
}
}

if (sizeof($least_likely_followers) > 1) {
$this->insight_dao->insertInsight('least_likely_followers', $instance->id, $this->insight_date,
"Good people:", sizeof($least_likely_followers)." interesting users followed you.",
$emphasis, serialize($least_likely_followers));
"Standouts:", sizeof($least_likely_followers)." interesting users followed you.",
Insight::EMPHASIS_LOW, serialize($least_likely_followers));
} else {
$this->insight_dao->insertInsight('least_likely_followers', $instance->id, $this->insight_date,
"Hey!", "An interesting user followed you.", $emphasis, serialize($least_likely_followers));
"Standout:", "An interesting user followed you.", Insight::EMPHASIS_LOW,
serialize($least_likely_followers));
}
}
$this->logger->logInfo("Done generating insight", __METHOD__.','.__LINE__);
Expand Down
8 changes: 4 additions & 4 deletions webapp/plugins/insightsgenerator/insights/listmembership.php
Expand Up @@ -58,14 +58,14 @@ public function generateInsight(Instance $instance, $last_week_of_posts, $number
$group_name_list .= '<a href="'.$group->url.'">'.$group->keyword.'</a>';
}
$this->insight_dao->insertInsight('new_group_memberships', $instance->id, $this->insight_date,
"Filed:", "You got added to ".sizeof($new_groups)." lists: ".$group_name_list.
"Made the list:", "You got added to ".sizeof($new_groups)." lists: ".$group_name_list.
", bringing your total to ".number_format(end($list_membership_count_history_by_day['history'])).
".", Insight::EMPHASIS_LOW, serialize($list_membership_count_history_by_day));
} else {
$new_groups[0]->setMetadata();
$this->insight_dao->insertInsight('new_group_memberships', $instance->id, $this->insight_date, "Filed:",
"You got added to a new list, ".'<a href="'.$new_groups[0]->url.'">'.$new_groups[0]->keyword.
"</a>, bringing your total to <strong>".
$this->insight_dao->insertInsight('new_group_memberships', $instance->id, $this->insight_date,
"Made the list:", "You got added to a new list, ".'<a href="'.$new_groups[0]->url.'">'.
$new_groups[0]->keyword."</a>, bringing your total to <strong>".
number_format(end($list_membership_count_history_by_day['history'])).
" lists</strong>.", Insight::EMPHASIS_LOW, serialize($list_membership_count_history_by_day));
}
Expand Down
12 changes: 5 additions & 7 deletions webapp/plugins/insightsgenerator/insights/retweetspike.php
Expand Up @@ -40,8 +40,6 @@ public function generateInsight(Instance $instance, $last_week_of_posts, $number

$simplified_post_date = "";
foreach ($last_week_of_posts as $post) {
$retweet_term = ($post->network == 'twitter')?'Retweet':'Reshare';

// First get spike/high 7/30/365 day baselines
if ($simplified_post_date != date('Y-m-d', strtotime($post->pub_date))) {
$simplified_post_date = date('Y-m-d', strtotime($post->pub_date));
Expand Down Expand Up @@ -71,7 +69,7 @@ public function generateInsight(Instance $instance, $last_week_of_posts, $number
&& $post->all_retweets >= $high_retweet_count_365_days->value) {
$this->insight_dao->insertInsight('retweet_high_365_day_'.$post->id, $instance->id,
$simplified_post_date, "New 365-day high!", $post->all_retweets." people reshared your post.",
Insight::EMPHASIS_HIGH, serialize($post));
Insight::EMPHASIS_LOW, serialize($post));

$this->insight_dao->deleteInsight('retweet_high_30_day_'.$post->id, $instance->id,
$simplified_post_date);
Expand All @@ -85,7 +83,7 @@ public function generateInsight(Instance $instance, $last_week_of_posts, $number
&& $post->all_retweets >= $high_retweet_count_30_days->value) {
$this->insight_dao->insertInsight('retweet_high_30_day_'.$post->id, $instance->id,
$simplified_post_date, "New 30-day high!", $post->all_retweets." people reshared your post.",
Insight::EMPHASIS_HIGH, serialize($post));
Insight::EMPHASIS_LOW, serialize($post));

$this->insight_dao->deleteInsight('retweet_high_7_day_'.$post->id, $instance->id,
$simplified_post_date);
Expand All @@ -97,7 +95,7 @@ public function generateInsight(Instance $instance, $last_week_of_posts, $number
&& $post->all_retweets >= $high_retweet_count_7_days->value) {
$this->insight_dao->insertInsight('retweet_high_7_day_'.$post->id, $instance->id, $simplified_post_date,
"New 7-day high!", $post->all_retweets." people reshared your post.",
Insight::EMPHASIS_HIGH, serialize($post));
Insight::EMPHASIS_LOW, serialize($post));

$this->insight_dao->deleteInsight('retweet_high_30_day_'.$post->id, $instance->id,
$simplified_post_date);
Expand All @@ -109,7 +107,7 @@ public function generateInsight(Instance $instance, $last_week_of_posts, $number
&& $post->all_retweets > ($average_retweet_count_30_days->value*2)) {
$multiplier = floor($post->all_retweets/$average_retweet_count_30_days->value);
$this->insight_dao->insertInsight('retweet_spike_30_day_'.$post->id, $instance->id,
$simplified_post_date, $retweet_term." spike!", $post->all_retweets.
$simplified_post_date, "Amplified:", $post->all_retweets.
" people reshared your post, more than ".$multiplier. "x your 30-day average.", Insight::EMPHASIS_LOW,
serialize($post));

Expand All @@ -123,7 +121,7 @@ public function generateInsight(Instance $instance, $last_week_of_posts, $number
&& $post->all_retweets > ($average_retweet_count_7_days->value*2)) {
$multiplier = floor($post->all_retweets/$average_retweet_count_7_days->value);
$this->insight_dao->insertInsight('retweet_spike_7_day_'.$post->id, $instance->id,
$simplified_post_date, $retweet_term." spike!", $post->all_retweets.
$simplified_post_date, "Amplified:", $post->all_retweets.
" people reshared your post, more than " .$multiplier. "x your 7-day average.",
Insight::EMPHASIS_LOW, serialize($post));

Expand Down
4 changes: 2 additions & 2 deletions webapp/plugins/insightsgenerator/insights/wordfrequency.php
Expand Up @@ -42,10 +42,10 @@ public function generateInsight(Instance $instance, $last_week_of_posts, $number
}
$simplified_post_date = date('Y-m-d', strtotime($post->pub_date));
$this->insight_dao->insertInsight('replies_frequent_words_'.$post->id, $instance->id,
$simplified_post_date, "Reply spike!",
$simplified_post_date, "Conversation starter:",
'Your post got '.$post->reply_count_cache.' replies. See <a href="'.$config->getValue('site_root_path').
'post/?t='.$post->post_id.'&n='.$post->network.'">the most frequently-mentioned reply words</a>.',
Insight::EMPHASIS_HIGH, serialize($post));
Insight::EMPHASIS_LOW, serialize($post));
}
}
}
Expand Down

0 comments on commit 74f5f65

Please sign in to comment.