Skip to content
Snippets Groups Projects
Commit 206716c5 authored by Mateus Rambo Strey's avatar Mateus Rambo Strey
Browse files

Merge branch 'fix-highlights-task' into 'master'

Fix highlights task



See merge request !47
parents eabd1737 b55fec2a
No related branches found
No related tags found
No related merge requests found
......@@ -11,6 +11,8 @@ class WelcomeController < ApplicationController
learning_object_repository.find(id)
end
@General = @General.take(3)
@Subjects = subject_repository.all
@Subjects.delete_if{|s| not s.highlights.present?}
@Subjects = @Subjects.take(8)
......
class Subject
include ActiveModel::Model
attr_accessor :id, :created_at, :description, :highlights, :name
attr_accessor :id, :created_at, :description, :highlights, :name, :learning_objects
def highlights
@highlights ||= subject_repository.get_highlights(self)
end
def learning_objects
@learning_objects ||= subject_repository.get_learning_objects(self)
end
def subject_repository
Portalmec::Application.repository.for :subject
end
end
\ No newline at end of file
end
......@@ -20,10 +20,10 @@ module OrientDb
return nil
end
#def update(id,operation,atributte,new)
# puts "update #{id} #{operation} #{atributte} = #{new}"
# connection.command "update #{id} #{operation} #{atributte} = #{new}"
#end
def update(id,operation,atributte,new)
puts "update #{id} #{operation} #{atributte} = #{new}"
connection.command "update #{id} #{operation} #{atributte} = #{new}"
end
private
......
......@@ -12,10 +12,10 @@ module OrientDb
connection.command "DELETE VERTEX Subject where @rid = '#{id}'"
end
#def update(id, operation, atributte, new_value)
# puts "update #{id} #{operation} #{atributte} = #{new_value}"
# connection.command "update #{id} #{operation} #{atributte} = #{new_value}"
#end
def update(id, operation, atributte, new_value)
puts "update #{id} #{operation} #{atributte} = #{new_value}"
connection.command "update #{id} #{operation} #{atributte} = #{new_value}"
end
def get_learning_objects(subject)
result = get_edges_end("IsAbout", "in", subject.id)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment