-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #97 from Next-Room/feature/analytics
[FEAT] ํต๊ณ ๋ฌธ์ ๋ณ ํ๊ท ํํธ ์ฌ์ฉ ํ์ API ๊ตฌํ
- Loading branch information
Showing
5 changed files
with
92 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
src/main/java/com/nextroom/nextRoomServer/repository/HintHistoryRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,20 @@ | ||
package com.nextroom.nextRoomServer.repository; | ||
|
||
import java.util.List; | ||
|
||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.data.jpa.repository.Query; | ||
import org.springframework.data.repository.query.Param; | ||
|
||
import com.nextroom.nextRoomServer.domain.HintHistory; | ||
|
||
public interface HintHistoryRepository extends JpaRepository<HintHistory, Long> { | ||
@Query(value = "SELECT A.hint_id AS id, COUNT(A.hint_id) AS hintOpenCount, SUM(A.answer_count) AS answerOpenCount " | ||
+ | ||
"FROM (SELECT hint_id, IF(answer_open_time IS NULL, 0, 1) AS answer_count " + | ||
"FROM play_history PH " + | ||
"INNER JOIN hint_history HH ON PH.play_history_id = HH.play_history_id " + | ||
"WHERE PH.theme_id = :themeId) A " + | ||
"GROUP BY A.hint_id", nativeQuery = true) | ||
List<Object[]> findAnalyticsByThemeId(@Param("themeId") Long themeId); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters