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
8d5467c3
Commit
8d5467c3
authored
9 years ago
by
Mauricio Giacomini Girardello
Browse files
Options
Downloads
Patches
Plain Diff
remove save method from learning object repository and improve create method
parent
f795811a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
app/repositories/orient_db/learning_object_repository.rb
+13
-12
13 additions, 12 deletions
app/repositories/orient_db/learning_object_repository.rb
with
13 additions
and
12 deletions
app/repositories/orient_db/learning_object_repository.rb
+
13
−
12
View file @
8d5467c3
...
@@ -25,7 +25,6 @@ module OrientDb
...
@@ -25,7 +25,6 @@ module OrientDb
# Usage:
# Usage:
# learning_object = repository.for(:learning_objects).get_by_dspace_id 123
# learning_object = repository.for(:learning_objects).get_by_dspace_id 123
#
def
get_by_dspace_id
(
id_dspace
)
def
get_by_dspace_id
(
id_dspace
)
result
=
select_by_property
(
odb_class
,
"id_dspace"
,
id_dspace
)
result
=
select_by_property
(
odb_class
,
"id_dspace"
,
id_dspace
)
build_object
result
.
first
build_object
result
.
first
...
@@ -58,17 +57,6 @@ module OrientDb
...
@@ -58,17 +57,6 @@ module OrientDb
attribute_repository
.
find_all_by_learning_object
learning_object
attribute_repository
.
find_all_by_learning_object
learning_object
end
end
def
create_relations
(
learning_object
)
relations
=
OrientDb
::
LearningObject
::
RelationsChain
.
new
(
learning_object
,
connection
)
relations
.
create
end
def
save
(
learning_object
)
if
learning_object
.
valid?
connection
.
command
"INSERT INTO LearningObject CONTENT
#{
learning_object
.
to_json
}
"
end
end
def
types
def
types
Rails
.
cache
.
fetch
(
"learning_object/types"
,
expires_in:
1
.
days
)
do
Rails
.
cache
.
fetch
(
"learning_object/types"
,
expires_in:
1
.
days
)
do
query
=
"SELECT DISTINCT(type) FROM LearningObject GROUP BY type"
query
=
"SELECT DISTINCT(type) FROM LearningObject GROUP BY type"
...
@@ -80,5 +68,18 @@ module OrientDb
...
@@ -80,5 +68,18 @@ module OrientDb
end
end
end
end
def
create
(
object
)
super
(
object
)
create_relations
object
object
end
private
def
create_relations
(
learning_object
)
relations
=
OrientDb
::
Associations
::
LearningObjectAssociations
.
new
(
learning_object
,
connection
)
relations
.
create
end
end
end
end
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