Permalink
Browse files

analysis engine

  • Loading branch information...
1 parent bb7b476 commit 88bd6bd896bbc0a2108dda8f86a3766edd0004e3 @sophaz sophaz committed Feb 27, 2012
Showing with 16 additions and 5 deletions.
  1. +13 −2 app/controllers/AnalysisEngine.java
  2. +3 −3 app/controllers/RecommendationEngine.java
@@ -1,10 +1,13 @@
package controllers;
import play.*;
+import play.db.jpa.JPA;
import play.mvc.*;
import java.util.*;
+import javax.persistence.Query;
+
import models.*;
public class AnalysisEngine extends Controller {
@@ -18,7 +21,15 @@ public static void makeSelection(long id, int selection) {
}
public static void reasonComparator(int reasonOneType, int reasonTwoType) {
- Reason reason1 = Reason.getCategoryReason(reasonOneType);
- Reason reason2 = Reason.getCategoryReason(reasonTwoType);
+ Reason reasonOne = Reason.find("byTypeAndIsCategory", reasonOneType, true).first();
+ Reason reasonTwo = Reason.find("byTypeAndIsCategory", reasonTwoType, true).first();
+
+ List<Choice> choicesOne = Choice.find("SELECT DISTINCT c " +
+ "FROM Choice c JOIN c.recommendations r WHERE " +
+ "? MEMBER OF r.reasons", reasonOne).fetch();
+
+ List<Choice> choicesTwo = Choice.find("SELECT DISTINCT c " +
+ "FROM Choice c JOIN c.recommendations r WHERE " +
+ "? MEMBER OF r.reasons", reasonTwo).fetch();
}
}
@@ -35,11 +35,11 @@
public class RecommendationEngine extends Controller{
public static void index() {
- //Application.generateFeeds();
- //LikeGroup.generateLikeGroupsFromStaticArray();
+ Application.generateFeeds();
+ LikeGroup.generateLikeGroupsFromStaticArray();
Application.getUserLikes();
- //RSSEngine.fetchNews();
+ RSSEngine.fetchNews();
Topic topic1 = fetchTopic(0);
Topic topic2 = fetchTopic(1);

0 comments on commit 88bd6bd

Please sign in to comment.