public override int calculateScore(IRecommendationsGetters dbPackingClass, BookGeneralData book, CurrentUser user) { if (ModuleInfo.Active) { LinkedList <Bonus> bonuses = dbPackingClass.getBonusFromAdmin(book); int sum = 0; foreach (Bonus b in bonuses) { sum += b.multiplicator; } makeConsoleLog(sum * ModuleInfo.MainMultiplicator); return(sum * ModuleInfo.MainMultiplicator); } return(0); }
public override int calculateScore(IRecommendationsGetters dbPackingClass, BookGeneralData book, CurrentUser user) { if (ModuleInfo.Active) { makeConsoleLog(ModuleInfo.MainMultiplicator * dbPackingClass.getNewBooksBonus(book)); return(ModuleInfo.MainMultiplicator * dbPackingClass.getNewBooksBonus(book)); } return(0); }
public override int calculateScore(IRecommendationsGetters dbPackingClass, BookGeneralData book, CurrentUser user) { if (ModuleInfo.Active) { LinkedList <BookGeneralData> books = dbPackingClass.getBooksWithGeneralDataWithin05hour(user); int recentlySearched = 0; foreach (BookGeneralData b in books) { if (b.id == book.id) { recentlySearched++; } } int recentlySearchedCategs = 0; LinkedList <string> bookCategs = dbPackingClass.getBookCategories(book); foreach (BookWithAuthorsAndCategories b in books) { LinkedList <string> secondBookCategs = dbPackingClass.getBookCategories(b); foreach (string categ in bookCategs) { if (secondBookCategs.Contains(categ)) { recentlySearchedCategs++; } } } makeConsoleLog(ModuleInfo.MainMultiplicator * (recentlySearched * ModuleInfo.getMultiplicatorAt("recentlySearched") + recentlySearchedCategs * ModuleInfo.getMultiplicatorAt("categories"))); return(ModuleInfo.MainMultiplicator * (recentlySearched * ModuleInfo.getMultiplicatorAt("recentlySearched") + recentlySearchedCategs * ModuleInfo.getMultiplicatorAt("categories"))); } return(0); }
public override int calculateScore(IRecommendationsGetters dbPackingClass, BookGeneralData book, CurrentUser user) { if (ModuleInfo.Active) { LinkedList <string> likedCategs = dbPackingClass.getLikedCategories(user); LinkedList <string> bookcategs = dbPackingClass.getBookCategories(book); int categsCount = 0; foreach (string categ in bookcategs) { if (likedCategs.Contains(categ)) { categsCount++; } } makeConsoleLog(categsCount * ModuleInfo.MainMultiplicator); return(categsCount * ModuleInfo.MainMultiplicator); } return(0); }
public override int calculateScore(IRecommendationsGetters dbPackingClass, BookGeneralData book, CurrentUser user) { if (ModuleInfo.Active) { LinkedList <BookGeneralData> recentlyRecommended = dbPackingClass.getBooksRecommendedWithin05h(user); int bonus = 0; foreach (Book b in recentlyRecommended) { if (b.id == book.id) { bonus++; } } makeConsoleLog(ModuleInfo.MainMultiplicator * bonus); return(ModuleInfo.MainMultiplicator * bonus); } return(0); }
public override int calculateScore(IRecommendationsGetters dbPackingClass, BookGeneralData book, CurrentUser user) { if (!ModuleInfo.Active) { int howManySimilarCategsBooksViewedIn05h = dbPackingClass.getNoOfSimilarBooksViewedWithinHalfAnHour(book, user); makeConsoleLog(howManySimilarCategsBooksViewedIn05h); return(ModuleInfo.MainMultiplicator * howManySimilarCategsBooksViewedIn05h); } return(0); }
public override int calculateScore(IRecommendationsGetters dbPackingClass, BookGeneralData book, CurrentUser user) { if (ModuleInfo.Active) { LinkedList <UserRatesInfoSet> userBooksRates = dbPackingClass.getAllRowsInRates(book); //sorted by userID, bookID int sum = 0; int count = 0; foreach (UserRatesInfoSet u in userBooksRates) { sum += u.Rate; count++; } int avg = 0; int retVal = avg; if (count > 0) { avg = (int)Math.Round(((double)sum) / count); int offset = -4; avg -= offset; double numberOfBoughtModifier = ((double)count) / ModuleInfo.getMultiplicatorAt("devider"); retVal = (int)(avg * numberOfBoughtModifier); } makeConsoleLog(retVal); return(retVal); /* * int currentUserIndex = 0; * int currentBookIndex = 0; * SimilarityMatrix matrix = prepareMatrix(userBooksRates,book.id, out currentUserIndex, out currentBookIndex); * * * double lowerThisUser = calculateRootOfSumOfSquared(matrix, currentUserIndex, currentBookIndex, thisUserAvg); */ } makeConsoleLog(0); return(0); }
public override int calculateScore(IRecommendationsGetters dbPackingClass, BookGeneralData book, CurrentUser user) { if (ModuleInfo.Active) { LinkedList <BookGeneralData> booksToBuy = dbPackingClass.getToBuyBooks(user); int booksWithTheSameCategs = FunctionsUtils.countSameCategoriesBooks(book, booksToBuy, dbPackingClass); int booksWithTheSameAuthors = FunctionsUtils.countAllSameAuthors(book, booksToBuy, dbPackingClass); makeConsoleLog(ModuleInfo.MainMultiplicator * (booksWithTheSameCategs * ModuleInfo.getMultiplicatorAt("SameCategory") + booksWithTheSameAuthors * ModuleInfo.getMultiplicatorAt("SameAuthor"))); return(ModuleInfo.MainMultiplicator * (booksWithTheSameCategs * ModuleInfo.getMultiplicatorAt("SameCategory") + booksWithTheSameAuthors * ModuleInfo.getMultiplicatorAt("SameAuthor"))); } return(0); }
public abstract int calculateScore(IRecommendationsGetters dbPackingClass, BookGeneralData book, CurrentUser user);