Skip to content

Commit

Permalink
Merge pull request #173 from john180/dev
Browse files Browse the repository at this point in the history
refactor: 格式化代码
  • Loading branch information
john180 authored Oct 28, 2024
2 parents 8d19c08 + 7a21335 commit 58f96e5
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -158,5 +158,4 @@ class UserController(
@Operation(summary = "查询用户信息")
@ApiResponse(description = "用户详情信息")
fun getUserInfo(@RequestParam userId: String): MaaResult<MaaUserInfo> = success(userService.get(userId))

}
4 changes: 1 addition & 3 deletions src/main/kotlin/plus/maa/backend/service/UserService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,5 @@ class UserService(
fun getOrDefault(id: String) = get(id) ?: MaaUser.UNKNOWN
}

fun get(userId: String): MaaUserInfo =
(userRepository.findByUserId(userId) ?: MaaUser.UNKNOWN).run(::MaaUserInfo)

fun get(userId: String): MaaUserInfo = (userRepository.findByUserId(userId) ?: MaaUser.UNKNOWN).run(::MaaUserInfo)
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ class JwtAuthenticationTokenFilterTest {
}
requireNotNull(SecurityContextHolder.getContext().authentication)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import plus.maa.backend.config.external.MaaCopilotProperties
@SpringBootTest
class GithubRepositoryTest(
@Autowired val repository: GithubRepository,
@Autowired val properties: MaaCopilotProperties
@Autowired val properties: MaaCopilotProperties,
) {
@Test
fun testGetTrees() {
Expand All @@ -26,4 +26,4 @@ class GithubRepositoryTest(
val contents = repository.getContents(properties.github.token, "")
check(contents.isNotEmpty())
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ class CopilotServiceTest {
lastWeekLikeCounts[1] = 6L
lastWeekDislikeCounts[1] = 1L


// 近期作业,差评较多,均为近期评分
val newBad = Copilot(doc = Copilot.Doc(title = "test"))
newBad.uploadTime = now
Expand All @@ -38,7 +37,6 @@ class CopilotServiceTest {
lastWeekLikeCounts[2] = 2L
lastWeekDislikeCounts[2] = 4L


// 一月前的作业,评分高,但是只有一条近期好评,浏览量尚可
val oldNormal = Copilot(doc = Copilot.Doc(title = "test"))
oldNormal.uploadTime = beforeWeek.minusDays(21L)
Expand All @@ -47,7 +45,6 @@ class CopilotServiceTest {
lastWeekLikeCounts[3] = 1L
lastWeekDislikeCounts[3] = 0L


// 新增作业,暂无评分
val newEmpty = Copilot(doc = Copilot.Doc(title = "test"))
newEmpty.uploadTime = now
Expand All @@ -57,8 +54,7 @@ class CopilotServiceTest {
lastWeekDislikeCounts[4] = 0L

for (i in 0..4) {
copilots[i]!!.hotScore =
getHotScore(copilots[i]!!, lastWeekLikeCounts[i], lastWeekDislikeCounts[i])
copilots[i]!!.hotScore = getHotScore(copilots[i]!!, lastWeekLikeCounts[i], lastWeekDislikeCounts[i])
}

// 近期好评 > 远古好评 > 近期新增 > 近期差评 > 远古一般
Expand Down

0 comments on commit 58f96e5

Please sign in to comment.