Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
31bf0cd8
Commit
31bf0cd8
authored
Nov 16, 2012
by
Alexey Loktionov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix projects sorting; fix Postgresql issue with LIMIT and DISTINCT; fix query performance
parent
b339c747
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
4 additions
and
4 deletions
+4
-4
app/controllers/dashboard_controller.rb
app/controllers/dashboard_controller.rb
+1
-1
app/controllers/groups_controller.rb
app/controllers/groups_controller.rb
+1
-1
app/roles/account.rb
app/roles/account.rb
+2
-2
No files found.
app/controllers/dashboard_controller.rb
View file @
31bf0cd8
...
@@ -5,7 +5,7 @@ class DashboardController < ApplicationController
...
@@ -5,7 +5,7 @@ class DashboardController < ApplicationController
def
index
def
index
@groups
=
Group
.
where
(
id:
current_user
.
projects
.
pluck
(
:group_id
))
@groups
=
Group
.
where
(
id:
current_user
.
projects
.
pluck
(
:group_id
))
@projects
=
current_user
.
projects_
with_events
@projects
=
current_user
.
projects_
sorted_by_activity
@projects
=
@projects
.
page
(
params
[
:page
]).
per
(
30
)
@projects
=
@projects
.
page
(
params
[
:page
]).
per
(
30
)
@events
=
Event
.
in_projects
(
current_user
.
project_ids
)
@events
=
Event
.
in_projects
(
current_user
.
project_ids
)
...
...
app/controllers/groups_controller.rb
View file @
31bf0cd8
...
@@ -54,7 +54,7 @@ class GroupsController < ApplicationController
...
@@ -54,7 +54,7 @@ class GroupsController < ApplicationController
end
end
def
projects
def
projects
@projects
||=
current_user
.
projects_
with_events
.
where
(
group_id:
@group
.
id
)
@projects
||=
current_user
.
projects_
sorted_by_activity
.
where
(
group_id:
@group
.
id
)
end
end
def
project_ids
def
project_ids
...
...
app/roles/account.rb
View file @
31bf0cd8
...
@@ -67,7 +67,7 @@ module Account
...
@@ -67,7 +67,7 @@ module Account
events
=
events
.
recent
.
limit
(
1
).
first
events
=
events
.
recent
.
limit
(
1
).
first
end
end
def
projects_
with_events
def
projects_
sorted_by_activity
projects
.
includes
(
:events
).
order
(
"events.created_at
DESC"
)
projects
.
order
(
"(SELECT max(events.created_at) FROM events WHERE events.project_id = projects.id)
DESC"
)
end
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment