|
@@ -43,8 +43,11 @@ class ContentDescription {
|
|
// After shuffling the list, descriptions with the highest scores go at the top, and between those the ones with the lowest saidCounts go first
|
|
// After shuffling the list, descriptions with the highest scores go at the top, and between those the ones with the lowest saidCounts go first
|
|
// If multiple descriptions have the same score/saidCount, they are picked randomly due to the previous shuffling.
|
|
// If multiple descriptions have the same score/saidCount, they are picked randomly due to the previous shuffling.
|
|
a.sort((a : ContentDescription, b : ContentDescription) => {
|
|
a.sort((a : ContentDescription, b : ContentDescription) => {
|
|
- let scoreA = a.getScore() / (a.saidCount + 1);
|
|
|
|
- let scoreB = b.getScore() / (b.saidCount + 1); // By dividing the score gby the amount of times it was said we increase rotation of descriptions
|
|
|
|
|
|
+ // Division by saidCount for now, to increase rotativity of descriptions
|
|
|
|
+ // Reduce precision on final number to decrease the likelihood of printing the same descriptions always in the same order
|
|
|
|
+ let precision = 5;
|
|
|
|
+ let scoreA = Math.floor(precision * a.getScore() / (a.saidCount + 1)) / precision;
|
|
|
|
+ let scoreB = Math.floor(precision * b.getScore() / (b.saidCount + 1)) / precision;
|
|
if (scoreA != scoreB) return scoreB - scoreA;
|
|
if (scoreA != scoreB) return scoreB - scoreA;
|
|
return 0;
|
|
return 0;
|
|
});
|
|
});
|