From 565ec2d5b2eb4de503caffcaf7cd2f35c2d94b26 Mon Sep 17 00:00:00 2001
From: Mateus Rambo Strey <mars11@inf.ufpr.br>
Date: Tue, 29 Sep 2015 09:59:45 -0300
Subject: [PATCH] fix mainPage highlights task

---
 lib/tasks/mainPage.rake | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/lib/tasks/mainPage.rake b/lib/tasks/mainPage.rake
index 28340ebb8..bb6e25e0c 100644
--- a/lib/tasks/mainPage.rake
+++ b/lib/tasks/mainPage.rake
@@ -1,10 +1,11 @@
 namespace :mainPage do
   desc "Generate the MainPage"
   task :highlights => :environment do
-    repository = Portalmec::Application.repository
+    include RepositoriesProxy
+    # repository = Portalmec::Application.repository
     puts 'Generate the main page subject highlights'
     general_highlights = Array.new
-    subjects = repository.for(:subject).all
+    subjects = subject_repository.all
     subjects.each do |subject|
       # select all the learning objects about that subject
       objects = subject.learning_objects
@@ -20,17 +21,17 @@ namespace :mainPage do
 
       # add the object to the subject highlight
       puts subject.name
-      repository.for(:subject).update(subject.id,'set','highlights','[]')
+      subject_repository.update(subject.id,'set','highlights','[]')
       objects.each do |object|
-        repository.for(:subject).update(subject.id,'add','highlights',object.name)
+        subject_repository.update(subject.id,'add','highlights',object.name)
       end
     end
     puts 'Generating the main page highlights'
-    mainPage = repository.for(:mainPage).all.first
+    mainPage = main_page_repository.all.first
     rid = mainPage['@rid']
-    repository.for(:mainPage).update(rid,'set','highlights','[]')
+    main_page_repository.update(rid,'set','highlights','[]')
     general_highlights.each do |general_highlight|
-      repository.for(:mainPage).update(rid,'add','highlights',general_highlight.name)
+      main_page_repository.update(rid,'add','highlights',general_highlight.name)
     end
   end
 end
-- 
GitLab