Skip to content

Commit

Permalink
Minimum score threshold for trends
Browse files Browse the repository at this point in the history
Extend tests
  • Loading branch information
Evgeniy Guseletov committed Aug 20, 2012
1 parent 4d1ff37 commit 2b2bab2
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions app/config/parameters.yml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ parameters:

knp_bundles.trending_bundle_twitterer.idle_period: 30 #days
knp_bundles.trending_bundle.min_score_diff: 3
knp_bundles.trending_bundle.min_score_threshold: 25

knp_bundles.github.client_id: your_client_id_here
knp_bundles.github.client_secret: your_client_secret_here
Expand Down
1 change: 1 addition & 0 deletions app/config/parameters.yml.test
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ parameters:

knp_bundles.trending_bundle_twitterer.idle_period: 30 #days
knp_bundles.trending_bundle.min_score_diff: 3
knp_bundles.trending_bundle.min_score_threshold: 25

knp_bundles.github.client_id: b46912af13ee7cb7ecd3
knp_bundles.github.client_secret: 116f5427707fcc2a3f7c630dd356be61500b2e18
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,12 @@ private function updateTrends()
AND score.diff > %s
SET trend1 = score.diff
WHERE score >= %s
EOF;

$minDiff = $this->getContainer()->getParameter('knp_bundles.trending_bundle.min_score_diff');
$query = sprintf($sql, $minDiff);
$minThreshold = $this->getContainer()->getParameter('knp_bundles.trending_bundle.min_score_threshold');
$query = sprintf($sql, $minDiff, $minThreshold);

$nbRows = $em->getConnection()->executeUpdate($query);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function setUp()
foreach ($data['bundles'] as $bundleName => $bundleData) {
$bundle = new Bundle('vendor/' . $bundleName);
$bundle->setDescription('some description');
$bundle->setScore(0);
$bundle->setScore(100);
$bundle->setUser($user);

foreach ($bundleData['scores'] as $scoreData) {
Expand Down

0 comments on commit 2b2bab2

Please sign in to comment.