Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ List<Object[]> findDailyContributionsByUserIds(
SELECT
user_id,
cast(date_trunc('month', study_date) as date) + (floor((extract(day from study_date) - 1) / 7) * 7)::int AS week_start,
AVG(commit_count + pr_count + review_count + issue_count) AS point,
SUM(commit_count + pr_count + review_count + issue_count) AS point,
ROW_NUMBER() OVER (PARTITION BY user_id ORDER BY cast(date_trunc('month', study_date) as date) + (floor((extract(day from study_date) - 1) / 7) * 7)::int DESC) as rn
FROM github_daily_stats
WHERE user_id IN (:userIds)
Expand All @@ -105,7 +105,7 @@ List<Object[]> findWeeklyContributionsByUserIds(
SELECT
user_id,
cast(date_trunc('month', study_date) as date) AS month_start,
AVG(commit_count + pr_count + review_count + issue_count) AS point,
SUM(commit_count + pr_count + review_count + issue_count) AS point,
ROW_NUMBER() OVER (PARTITION BY user_id ORDER BY date_trunc('month', study_date) DESC) as rn
FROM github_daily_stats
WHERE user_id IN (:userIds)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,13 @@ Optional<UserExpHistoryJpaEntity> findByUserAndDateAndActingCategory(
SELECT
fk_user_id,
cast(date_trunc('day', date) as date) AS day_date,
AVG(earn_exp) AS point,
SUM(earn_exp) AS point,
Comment thread
hjbin-25 marked this conversation as resolved.
ROW_NUMBER() OVER (PARTITION BY fk_user_id ORDER BY date_trunc('day', date) DESC) as rn
FROM user_exp_history
WHERE fk_user_id IN (:userIds)
AND date >= date_trunc('day', CAST(:startDate AS date))
AND date <= :endDate
AND acting_category <> 'SEASON_RESET'
GROUP BY fk_user_id, date_trunc('day', date)
) subquery
WHERE rn <= 10
Expand All @@ -67,12 +68,13 @@ List<Object[]> findDailyDataByUserIds(
SELECT
fk_user_id,
cast(date_trunc('month', date) as date) + (floor((extract(day from date) - 1) / 7) * 7)::int AS week_start,
AVG(earn_exp) AS point,
SUM(earn_exp) AS point,
ROW_NUMBER() OVER (PARTITION BY fk_user_id ORDER BY cast(date_trunc('month', date) as date) + (floor((extract(day from date) - 1) / 7) * 7)::int DESC) as rn
FROM user_exp_history
WHERE fk_user_id IN (:userIds)
AND date >= :startDate
AND date <= :endDate
AND acting_category <> 'SEASON_RESET'
GROUP BY fk_user_id, cast(date_trunc('month', date) as date) + (floor((extract(day from date) - 1) / 7) * 7)::int
) subquery
WHERE rn <= 10
Expand All @@ -96,12 +98,13 @@ List<Object[]> findWeeklyDataByUserIds(
SELECT
fk_user_id,
cast(date_trunc('month', date) as date) AS month_start,
AVG(earn_exp) AS point,
SUM(earn_exp) AS point,
ROW_NUMBER() OVER (PARTITION BY fk_user_id ORDER BY date_trunc('month', date) DESC) as rn
FROM user_exp_history
WHERE fk_user_id IN (:userIds)
AND date >= date_trunc('month', CAST(:startDate AS date))
AND date <= :endDate
AND acting_category <> 'SEASON_RESET'
GROUP BY fk_user_id, date_trunc('month', date)
) subquery
WHERE rn <= 10
Expand Down
Loading