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
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
85e03904
Commit
85e03904
authored
Apr 03, 2013
by
Andrey Kumanyaev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix tests
parent
734d6fcd
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
8 deletions
+8
-8
app/models/project.rb
app/models/project.rb
+6
-6
spec/models/project_spec.rb
spec/models/project_spec.rb
+2
-2
No files found.
app/models/project.rb
View file @
85e03904
...
@@ -86,13 +86,13 @@ class Project < ActiveRecord::Base
...
@@ -86,13 +86,13 @@ class Project < ActiveRecord::Base
validate
:check_limit
,
:repo_name
validate
:check_limit
,
:repo_name
# Scopes
# Scopes
scope
:without_user
,
->
(
user
)
{
where
(
"id NOT IN (:ids)"
,
ids:
user
.
authorized_projects
.
map
(
&
:id
)
)
}
scope
:without_user
,
->
(
user
)
{
where
(
"
projects.
id NOT IN (:ids)"
,
ids:
user
.
authorized_projects
.
map
(
&
:id
)
)
}
scope
:without_team
,
->
(
team
)
{
team
.
projects
.
present?
?
where
(
"id NOT IN (:ids)"
,
ids:
team
.
projects
.
map
(
&
:id
))
:
scoped
}
scope
:without_team
,
->
(
team
)
{
team
.
projects
.
present?
?
where
(
"
projects.
id NOT IN (:ids)"
,
ids:
team
.
projects
.
map
(
&
:id
))
:
scoped
}
scope
:not_in_group
,
->
(
group
)
{
where
(
"id NOT IN (:ids)"
,
ids:
group
.
project_ids
)
}
scope
:not_in_group
,
->
(
group
)
{
where
(
"
projects.
id NOT IN (:ids)"
,
ids:
group
.
project_ids
)
}
scope
:in_team
,
->
(
team
)
{
where
(
"id IN (:ids)"
,
ids:
team
.
projects
.
map
(
&
:id
))
}
scope
:in_team
,
->
(
team
)
{
where
(
"
projects.
id IN (:ids)"
,
ids:
team
.
projects
.
map
(
&
:id
))
}
scope
:in_namespace
,
->
(
namespace
)
{
where
(
namespace_id:
namespace
.
id
)
}
scope
:in_namespace
,
->
(
namespace
)
{
where
(
namespace_id:
namespace
.
id
)
}
scope
:in_group_namespace
,
->
{
joins
(
:group
)
}
scope
:in_group_namespace
,
->
{
joins
(
:group
)
}
scope
:sorted_by_activity
,
->
{
order
(
"last_activity_at DESC"
)
}
scope
:sorted_by_activity
,
->
{
order
(
"
projects.
last_activity_at DESC"
)
}
scope
:personal
,
->
(
user
)
{
where
(
namespace_id:
user
.
namespace_id
)
}
scope
:personal
,
->
(
user
)
{
where
(
namespace_id:
user
.
namespace_id
)
}
scope
:joined
,
->
(
user
)
{
where
(
"namespace_id != ?"
,
user
.
namespace_id
)
}
scope
:joined
,
->
(
user
)
{
where
(
"namespace_id != ?"
,
user
.
namespace_id
)
}
scope
:public_only
,
->
{
where
(
public:
true
)
}
scope
:public_only
,
->
{
where
(
public:
true
)
}
...
@@ -190,7 +190,7 @@ class Project < ActiveRecord::Base
...
@@ -190,7 +190,7 @@ class Project < ActiveRecord::Base
end
end
def
last_activity_date
def
last_activity_date
last_activity_at
last_activity_at
||
updated_at
end
end
def
project_id
def
project_id
...
...
spec/models/project_spec.rb
View file @
85e03904
...
@@ -108,8 +108,8 @@ describe Project do
...
@@ -108,8 +108,8 @@ describe Project do
describe
'last_activity_date'
do
describe
'last_activity_date'
do
it
'returns the creation date of the project\'s last event if present'
do
it
'returns the creation date of the project\'s last event if present'
do
project
.
stub
(
last_event:
last_even
t
)
last_activity_event
=
create
(
:event
,
project:
projec
t
)
project
.
last_activity_date
.
should
==
last_event
.
created_at
project
.
last_activity_date
.
to_s
(
:db
).
should
==
last_event
.
created_at
.
to_s
(
:db
)
end
end
it
'returns the project\'s last update date if it has no events'
do
it
'returns the project\'s last update date if it has no events'
do
...
...
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