Skip to content

Commit

Permalink
fix: 论文中止扣分逻辑修改.
Browse files Browse the repository at this point in the history
  • Loading branch information
GLaxky committed Apr 29, 2024
1 parent 719f495 commit f14b362
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ public void updateUserInfo(@RequestBody User user) {
*/
@GetMapping("/system/disable/user/{uid}")
public void disableUser(@PathVariable int uid) {

systemService.disableUser(uid);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,14 @@ public interface UserRepository extends CustomizedRepository<User, Integer>, Jpa
@Query("update User set deleted = false where id = :uid")
void enableUser(int uid);

/**
* 停用用户
* @param uid
*/
@Modifying
@Query("update User set deleted = true where id = :uid")
void disableUser(int uid);

/**
* 查询所有被禁用的用户
* @return
Expand Down
5 changes: 4 additions & 1 deletion src/main/java/com/softeng/dingtalk/service/PaperService.java
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,10 @@ public double calculateWeightOfAc(InternalPaper internalPaper) {
* @return AC值
*/
public double calculateAc(InternalPaper internalPaper, double sum, int rank) {
return calculateWeightOfAc(internalPaper) * calculateRatioOfAc(rank) * sum;
// 论文中止时,只有第一作者扣分
double flagForSuspend = (internalPaper.getResult() == InternalPaper.SUSPEND && rank == 1) ? 1.0 : 0.0;

return calculateWeightOfAc(internalPaper) * calculateRatioOfAc(rank) * sum * flagForSuspend;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ public void updateUserInfo(User u) {
* @param uid
*/
public void disableUser(int uid) {
userRepository.deleteById(uid);
userRepository.disableUser(uid);
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ private AcRecord generateAcRecord(String title, User user, boolean voteDetail, i
// todo- 论文投票AC变化,对于硕士生是1分,对于博士生是2分
.ac(coefficient * (user.getPosition() == Position.DOCTOR ? 2 : 1))
.classify(AcRecord.VOTE)
.reason((coefficient == 0 ? "投稿中止:" : (coefficient == 1 ? "投票预测正确:" : "投票预测错误:") + title))
.reason((coefficient == 0 ? "投稿中止:" + title: (coefficient == 1 ? "投票预测正确:" : "投票预测错误:") + title))
.createTime(dateTime)
.build();
}
Expand Down

0 comments on commit f14b362

Please sign in to comment.