Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15413291
D20782.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D20782.id.diff
View Options
diff --git a/src/applications/system/engine/PhabricatorSystemActionEngine.php b/src/applications/system/engine/PhabricatorSystemActionEngine.php
--- a/src/applications/system/engine/PhabricatorSystemActionEngine.php
+++ b/src/applications/system/engine/PhabricatorSystemActionEngine.php
@@ -100,32 +100,34 @@
$actor_hashes = array();
foreach ($actors as $actor) {
- $actor_hashes[] = PhabricatorHash::digestForIndex($actor);
+ $digest = PhabricatorHash::digestForIndex($actor);
+ $actor_hashes[$digest] = $actor;
}
$log = new PhabricatorSystemActionLog();
$window = self::getWindow();
- $conn_r = $log->establishConnection('r');
- $scores = queryfx_all(
- $conn_r,
- 'SELECT actorIdentity, SUM(score) totalScore FROM %T
+ $conn = $log->establishConnection('r');
+
+ $rows = queryfx_all(
+ $conn,
+ 'SELECT actorHash, SUM(score) totalScore FROM %T
WHERE action = %s AND actorHash IN (%Ls)
AND epoch >= %d GROUP BY actorHash',
$log->getTableName(),
$action->getActionConstant(),
- $actor_hashes,
- (time() - $window));
+ array_keys($actor_hashes),
+ (PhabricatorTime::getNow() - $window));
- $scores = ipull($scores, 'totalScore', 'actorIdentity');
+ $rows = ipull($rows, 'totalScore', 'actorHash');
- foreach ($scores as $key => $score) {
- $scores[$key] = $score / $window;
+ $scores = array();
+ foreach ($actor_hashes as $digest => $actor) {
+ $score = idx($rows, $digest, 0);
+ $scores[$actor] = ($score / $window);
}
- $scores = $scores + array_fill_keys($actors, 0);
-
return $scores;
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Mar 20, 5:51 PM (1 w, 3 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7379973
Default Alt Text
D20782.id.diff (1 KB)
Attached To
Mode
D20782: Fix "ONLY_FULL_GROUP_BY" issue in SystemAction queries
Attached
Detach File
Event Timeline
Log In to Comment