|
|
@@ -10,6 +10,7 @@ import com.seecoder.dataanalysis.data.entity.devcloud.display.FormatStudent;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
+import java.text.DecimalFormat;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
@@ -41,6 +42,7 @@ public class DevcloudScoreServiceImpl implements DevcloudScoreService {
|
|
|
public FormatScore getGroupScore(int user_id){
|
|
|
FormatScore formatScore = new FormatScore();
|
|
|
FormatGroup formatGroup = displayService.getGroupAnalysisById(user_id);
|
|
|
+ DecimalFormat df = new DecimalFormat("#.00");
|
|
|
//commit
|
|
|
int commit_times = formatGroup.getCommit().getCommit_times();
|
|
|
int commit_valid_times = formatGroup.getCommit().getValid_commit_times();
|
|
|
@@ -63,7 +65,8 @@ public class DevcloudScoreServiceImpl implements DevcloudScoreService {
|
|
|
commitScore2 = commit_valid_rate/COMMIT_VALID_RATE * 100;
|
|
|
}
|
|
|
commitScore = (commitScore1+commitScore2)/2;
|
|
|
- formatScore.setCommitScore(commitScore);
|
|
|
+
|
|
|
+ formatScore.setCommitScore(Double.valueOf(df.format(commitScore)));
|
|
|
|
|
|
//bugList
|
|
|
int bug_times = formatGroup.getBuglist().getBug_times();
|
|
|
@@ -86,7 +89,7 @@ public class DevcloudScoreServiceImpl implements DevcloudScoreService {
|
|
|
bugScore2 = bug_finished_rate/BUG_FINISHED_RATE * 100;
|
|
|
}
|
|
|
bugScore = (bugScore1+bugScore2)/2;
|
|
|
- formatScore.setBugScore(bugScore);
|
|
|
+ formatScore.setBugScore(Double.valueOf(df.format(bugScore)));
|
|
|
|
|
|
//nodeList
|
|
|
int treeNode_times = formatGroup.getTreeNode().getTreeNode_times();
|
|
|
@@ -109,7 +112,7 @@ public class DevcloudScoreServiceImpl implements DevcloudScoreService {
|
|
|
nodeScore2 = treeNode_finished_rate/NODE_FINISHED_RATE * 100;
|
|
|
}
|
|
|
nodeScore = (nodeScore1+nodeScore2)/2;
|
|
|
- formatScore.setNodeScore(nodeScore);
|
|
|
+ formatScore.setNodeScore(Double.valueOf(df.format(nodeScore)));
|
|
|
|
|
|
//pipeline
|
|
|
int pipeline_times = formatGroup.getPipeline().getPipeline_deploy();
|
|
|
@@ -132,7 +135,7 @@ public class DevcloudScoreServiceImpl implements DevcloudScoreService {
|
|
|
pipelineScore2 = pipeline_success_rate/PIPELINE_SUCCESS_RATE * 100;
|
|
|
}
|
|
|
pipelineScore = (nodeScore1+nodeScore2)/2;
|
|
|
- formatScore.setPipelineScore(pipelineScore);
|
|
|
+ formatScore.setPipelineScore(Double.valueOf(df.format(pipelineScore)));
|
|
|
|
|
|
//bonus,根据学生的分数占比计算
|
|
|
List<Contribution> commitContribution = formatGroup.getCommit().getCommit_contribution();
|
|
|
@@ -294,6 +297,7 @@ public class DevcloudScoreServiceImpl implements DevcloudScoreService {
|
|
|
public FormatScore getBasicScore(int user_id){
|
|
|
FormatScore formatScore = new FormatScore();
|
|
|
FormatStudent formatStudent = devcloudDataAnalysisService.getStudentAnalysis(user_id);
|
|
|
+ DecimalFormat df = new DecimalFormat("#.00");
|
|
|
//commit
|
|
|
int commit_times = formatStudent.getCommit().getCommit_times();
|
|
|
int commit_valid_times = formatStudent.getCommit().getValid_commit_times();
|
|
|
@@ -318,7 +322,7 @@ public class DevcloudScoreServiceImpl implements DevcloudScoreService {
|
|
|
// System.out.println(commit_times);
|
|
|
// System.out.println(user_id+": "+commit_valid_rate);
|
|
|
// System.out.println(user_id+": "+commitScore1+" and "+commitScore2);
|
|
|
- formatScore.setCommitScore(commitScore);
|
|
|
+ formatScore.setCommitScore(Double.valueOf(df.format(commitScore)));
|
|
|
|
|
|
//bugList
|
|
|
int bug_times = formatStudent.getBuglist().getBug_times();
|
|
|
@@ -341,7 +345,7 @@ public class DevcloudScoreServiceImpl implements DevcloudScoreService {
|
|
|
bugScore2 = bug_finished_rate/BUG_FINISHED_RATE * 100;
|
|
|
}
|
|
|
bugScore = (bugScore1+bugScore2)/2;
|
|
|
- formatScore.setBugScore(bugScore);
|
|
|
+ formatScore.setBugScore(Double.valueOf(df.format(bugScore)));
|
|
|
|
|
|
//nodeList
|
|
|
int treeNode_times = formatStudent.getTreeNode().getTreeNode_times();
|
|
|
@@ -364,7 +368,7 @@ public class DevcloudScoreServiceImpl implements DevcloudScoreService {
|
|
|
nodeScore2 = treeNode_finished_rate/NODE_FINISHED_RATE * 100;
|
|
|
}
|
|
|
nodeScore = (nodeScore1+nodeScore2)/2;
|
|
|
- formatScore.setNodeScore(nodeScore);
|
|
|
+ formatScore.setNodeScore(Double.valueOf(df.format(nodeScore)));
|
|
|
|
|
|
//pipeline
|
|
|
int pipeline_times = formatStudent.getPipeline().getPipeline_deploy();
|
|
|
@@ -387,7 +391,7 @@ public class DevcloudScoreServiceImpl implements DevcloudScoreService {
|
|
|
pipelineScore2 = pipeline_success_rate/PIPELINE_SUCCESS_RATE * 100;
|
|
|
}
|
|
|
pipelineScore = (nodeScore1+nodeScore2)/2;
|
|
|
- formatScore.setPipelineScore(pipelineScore);
|
|
|
+ formatScore.setPipelineScore(Double.valueOf(df.format(pipelineScore)));
|
|
|
|
|
|
return formatScore;
|
|
|
}
|