|
1 | 1 |
|
2 | 2 | const config = require('./config.js'), |
3 | 3 | algo = require('./algorithms.js'), |
4 | | - async = require('async'); |
5 | | - |
6 | | -const CLASSNAME = config.className; |
| 4 | + async = require('async'), |
| 5 | + Key = require('./key'); |
7 | 6 |
|
8 | 7 | const updateSequence = function(userId, itemId, options = {}){ |
9 | 8 | let updateWilson = true; |
@@ -41,12 +40,9 @@ const changeRating = function(userId, itemId, options){ |
41 | 40 |
|
42 | 41 | const removeRating = options['removeRating'] ? true : false; |
43 | 42 |
|
44 | | - const feeling = options['liked'] ? 'liked' : 'disliked'; |
45 | | - const mostFeeling = options['liked'] ? 'mostLiked' : 'mostDisliked'; |
46 | | - |
47 | | - const feelingItemSet = [CLASSNAME, 'item', itemId, feeling].join(':'); |
48 | | - const feelingUserSet = [CLASSNAME, 'user', userId, feeling].join(':'); |
49 | | - const mostFeelingSet = [CLASSNAME, mostFeeling].join(':'); |
| 43 | + const feelingItemSet = options['liked'] ? Key.itemLikedBySet(itemId) : Key.itemDislikedBySet(itemId); |
| 44 | + const feelingUserSet = options['liked'] ? Key.userLikedSet(userId) : Key.userDislikedSet(userId); |
| 45 | + const mostFeelingSet = options['liked'] ? Key.mostLiked() : Key.mostDisliked(); |
50 | 46 |
|
51 | 47 | return new Promise((resolve, reject) => { |
52 | 48 | Promise.resolve().then(() => { |
|
0 commit comments