Skip to content

Commit

Permalink
avgの計算方法変更
Browse files Browse the repository at this point in the history
  • Loading branch information
eatski committed Apr 6, 2024
1 parent 3ef8525 commit 6395d8f
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/server/services/story/ranking/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,15 @@ export const getStoriesRecommended = async (): Promise<StoryHead[]> => {
const questionLogsLength = questionLogs.length;
const bunned = evaluations.some((e) => e.rating === 0);
const avg =
evaluations.reduce((acc, e) => acc + (e.rating - 2.5), 0) /
evaluations.length;
evaluations.reduce((acc, e) => acc + e.rating, 0) / evaluations.length;
const questionExamplesLength = hydreted.questionExamples.length;
const random = Math.random();
const timeFromPublished =
(story.publishedAt ? now - story.publishedAt.getTime() : 0) + ONE_DAY;

const score = !bunned
? ((correctSolutionsLength + 1) *
(avg + 5) *
(avg + 1) *
(questionLogsLength + 100) *
(questionExamplesLength + 10) *
Math.pow(random, 2)) /
Expand Down

0 comments on commit 6395d8f

Please sign in to comment.