return 100 * (n * x - sum) / (int64_t)int_sqrt(n * qd);
}
-static long compute_dynamic_score(struct afs_info *afsi)
+static long compute_score(struct afs_info *afsi, long mood_score)
{
- return -normalized_value(afsi->num_played, statistics.num,
- statistics.num_played_sum, statistics.num_played_qd)
- - normalized_value(afsi->last_played, statistics.num,
- statistics.last_played_sum, statistics.last_played_qd);
+ mood_score -= normalized_value(afsi->num_played, statistics.num,
+ statistics.num_played_sum, statistics.num_played_qd);
+ mood_score -= normalized_value(afsi->last_played, statistics.num,
+ statistics.last_played_sum, statistics.last_played_qd);
+ return mood_score / 3;
}
static int add_afs_statistics(const struct osl_row *row)
if (ret < 0)
return ret;
- score = (compute_dynamic_score(&afsi) + mood_score) / 3;
+ score = compute_score(&afsi, mood_score);
return score_add(aft_row, score);
}
if (ret < 0)
return ret;
}
- score += compute_dynamic_score(&afsi);
- score /= 3;
+ score = compute_score(&afsi, score);
PARA_DEBUG_LOG("score: %li\n", score);
percent = (score + 100) / 3;
if (percent > 100)