Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
plugins
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
GLPI
plugins
Commits
e1f35d8a
Commit
e1f35d8a
authored
1 year ago
by
Cédric Anne
Browse files
Options
Downloads
Patches
Plain Diff
Used indexed field on count/groupby operations
parent
b0ddab3c
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
api/src/models/Plugin.php
+2
-2
2 additions, 2 deletions
api/src/models/Plugin.php
with
2 additions
and
2 deletions
api/src/models/Plugin.php
+
2
−
2
View file @
e1f35d8a
...
...
@@ -111,10 +111,10 @@ class Plugin extends Model {
public
function
scopeTrendingTop
(
$query
)
{
$query
->
select
([
'plugin.id'
,
'plugin.name'
,
'plugin.key'
,
'plugin.download_count'
,
DB
::
raw
(
'COUNT(
name
) as recent_downloads'
)])
DB
::
raw
(
'COUNT(
plugin.id
) as recent_downloads'
)])
->
join
(
'plugin_download'
,
'plugin.id'
,
'='
,
'plugin_download.plugin_id'
)
->
where
(
'downloaded_at'
,
'>'
,
DB
::
raw
(
'NOW() - INTERVAL 1 MONTH'
))
->
groupBy
(
'plugin.
name
'
)
->
groupBy
(
'plugin.
id
'
)
->
orderBy
(
'recent_downloads'
,
'DESC'
);
return
$query
;
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment