Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
cleaning-portalmec
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Harbor Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
Richard Fernando Heise Ferreira
cleaning-portalmec
Commits
e8fd2af5
Commit
e8fd2af5
authored
9 years ago
by
Mauricio Giacomini Girardello
Browse files
Options
Downloads
Patches
Plain Diff
adding new verifications for bookmarks and has_bookmarks? methods
parent
4dc92b22
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
app/models/collection.rb
+1
-1
1 addition, 1 deletion
app/models/collection.rb
app/repositories/orient_db/collection_repository.rb
+16
-6
16 additions, 6 deletions
app/repositories/orient_db/collection_repository.rb
lib/repository/environments.rb
+0
-1
0 additions, 1 deletion
lib/repository/environments.rb
with
17 additions
and
8 deletions
app/models/collection.rb
+
1
−
1
View file @
e8fd2af5
...
...
@@ -6,7 +6,7 @@ class Collection
validates_presence_of
:name
,
:created_at
,
:owner
,
:learning_objects
validates_with
Validators
::
CollectionOwnerValidator
def
initialize
(
params
=
{})
def
initialize
(
params
=
{})
super
(
params
.
merge
(
defaults
))
end
...
...
This diff is collapsed.
Click to expand it.
app/repositories/orient_db/collection_repository.rb
+
16
−
6
View file @
e8fd2af5
...
...
@@ -3,8 +3,7 @@ module OrientDb
include
OrientDb
::
Methods
::
EdgeMethods
def
build_object
(
args
=
{})
Collection
.
new
(
args
.
merge
(
id:
args
[
'@rid'
],
name:
args
[
'name'
]))
Collection
.
new
(
args
)
end
def
create_bookmarks_collection
(
user
)
...
...
@@ -16,9 +15,8 @@ module OrientDb
end
def
destroy_bookmarks_collection
(
user
)
bookmarks
=
Bookmarks
.
new
(
owner:
user
)
if
has_bookmarks?
(
user
)
bookmarks
=
user
.
bookmarks
if
has_bookmarks?
bookmarks
destroy
bookmarks
end
end
...
...
@@ -39,10 +37,22 @@ module OrientDb
def
bookmarks
(
user
)
result
=
connection
.
query
(
sprintf
(
"select expand(in('BelongsTo')) from %s where name = '%s'"
,
user
.
rid
,
'Bookmarks'
))
build_object
(
result
.
first
)
if
!
result
.
empty?
return
build_object
(
result
.
first
)
end
# returns a null object
Bookmarks
.
new
(
owner:
user
)
end
def
has_bookmarks?
(
user
)
# checks if bookmarks id is defined
if
user
.
bookmarks
.
id
.
nil?
return
false
end
# checks if edge exists
edge_exists?
'BelongsTo'
,
user
.
bookmarks
.
id
,
user
.
rid
end
...
...
This diff is collapsed.
Click to expand it.
lib/repository/environments.rb
+
0
−
1
View file @
e8fd2af5
...
...
@@ -2,7 +2,6 @@
class
Repository::Environments
def
self
.
create
(
env
)
env
=
env
environments
[
env
]
=
Repository
::
Repository
.
new
yield
(
environments
[
env
])
if
block_given?
end
...
...
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