|
|
@@ -44,8 +44,14 @@ public class DevcloudScoreServiceImpl implements DevcloudScoreService {
|
|
|
//commit
|
|
|
int commit_times = formatGroup.getCommit().getCommit_times();
|
|
|
int commit_valid_times = formatGroup.getCommit().getValid_commit_times();
|
|
|
- double commit_valid_rate = (double) commit_valid_times/(double) commit_times;
|
|
|
+ double commit_valid_rate=0.0;
|
|
|
+ if(commit_times<=0){
|
|
|
+ commit_valid_rate = 0.0;
|
|
|
+ }else {
|
|
|
+ commit_valid_rate = (double) commit_valid_times/(double) commit_times;
|
|
|
+ }
|
|
|
double commitScore1 = 0.0,commitScore2 = 0.0,commitScore=0.0;
|
|
|
+ System.out.println(commit_times);
|
|
|
if(commit_times>=COMMIT_TIME){
|
|
|
commitScore1 = 100;
|
|
|
}else {
|
|
|
@@ -62,7 +68,12 @@ public class DevcloudScoreServiceImpl implements DevcloudScoreService {
|
|
|
//bugList
|
|
|
int bug_times = formatGroup.getBuglist().getBug_times();
|
|
|
int bug_finished_times = formatGroup.getBuglist().getFinished_times();
|
|
|
- double bug_finished_rate = (double)bug_finished_times/(double)bug_times;
|
|
|
+ double bug_finished_rate = 0.0;
|
|
|
+ if(bug_times<=0){
|
|
|
+ bug_finished_rate = 0.0;
|
|
|
+ }else {
|
|
|
+ bug_finished_rate = (double)bug_finished_times/(double)bug_times;
|
|
|
+ }
|
|
|
double bugScore1=0.0,bugScore2=0.0,bugScore=0.0;
|
|
|
if(bug_times>=BUG_TIME){
|
|
|
bugScore1 = 100;
|
|
|
@@ -80,7 +91,12 @@ public class DevcloudScoreServiceImpl implements DevcloudScoreService {
|
|
|
//nodeList
|
|
|
int treeNode_times = formatGroup.getTreeNode().getTreeNode_times();
|
|
|
int treeNode_finished_times = formatGroup.getTreeNode().getFinished_treeNode_times();
|
|
|
- double treeNode_finished_rate = (double) treeNode_finished_times/ (double) treeNode_times;
|
|
|
+ double treeNode_finished_rate = 0.0;
|
|
|
+ if(treeNode_times<=0){
|
|
|
+ treeNode_finished_rate = 0.0;
|
|
|
+ }else {
|
|
|
+ treeNode_finished_rate = (double)treeNode_finished_times/(double)treeNode_times;
|
|
|
+ }
|
|
|
double nodeScore1=0.0,nodeScore2=0.0,nodeScore=0.0;
|
|
|
if(treeNode_times>=NODE_TIME){
|
|
|
nodeScore1 = 100;
|
|
|
@@ -98,7 +114,12 @@ public class DevcloudScoreServiceImpl implements DevcloudScoreService {
|
|
|
//pipeline
|
|
|
int pipeline_times = formatGroup.getPipeline().getPipeline_deploy();
|
|
|
int pipeline_success_times = formatGroup.getPipeline().getPipeline_pass();
|
|
|
- double pipeline_success_rate = (double)pipeline_success_times/(double)pipeline_times;
|
|
|
+ double pipeline_success_rate = 0.0;
|
|
|
+ if(pipeline_times<=0){
|
|
|
+ pipeline_success_rate = 0.0;
|
|
|
+ }else {
|
|
|
+ pipeline_success_rate = (double)pipeline_success_times/(double)pipeline_times;
|
|
|
+ }
|
|
|
double pipelineScore1=0.0,pipelineScore2=0.0,pipelineScore=0.0;
|
|
|
if(pipeline_times>=PIPELINE_TIME){
|
|
|
pipelineScore1 = 100;
|
|
|
@@ -169,7 +190,11 @@ public class DevcloudScoreServiceImpl implements DevcloudScoreService {
|
|
|
double preScore = Math.ceil((commitScore+bugScore+nodeScore+pipelineScore)/4);
|
|
|
double bonus = Math.ceil(s);
|
|
|
|
|
|
- formatScore.setTotalScore(preScore+bonus);
|
|
|
+ if(preScore+bonus>100){
|
|
|
+ formatScore.setTotalScore(100.0);
|
|
|
+ }else {
|
|
|
+ formatScore.setTotalScore(preScore+bonus);
|
|
|
+ }
|
|
|
formatScore.setBonus(bonus);
|
|
|
|
|
|
return formatScore;
|
|
|
@@ -255,7 +280,11 @@ public class DevcloudScoreServiceImpl implements DevcloudScoreService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- formatScoreMain.setTotalScore(ori[targetIndex]);
|
|
|
+ if(ori[targetIndex]>100){
|
|
|
+ formatScoreMain.setTotalScore(100.0);
|
|
|
+ }else {
|
|
|
+ formatScoreMain.setTotalScore(ori[targetIndex]);
|
|
|
+ }
|
|
|
formatScoreMain.setBonus(bonusScore.get(user_id));
|
|
|
|
|
|
return formatScoreMain;
|
|
|
@@ -268,7 +297,12 @@ public class DevcloudScoreServiceImpl implements DevcloudScoreService {
|
|
|
//commit
|
|
|
int commit_times = formatStudent.getCommit().getCommit_times();
|
|
|
int commit_valid_times = formatStudent.getCommit().getValid_commit_times();
|
|
|
- double commit_valid_rate = (double) commit_valid_times/(double) commit_times;
|
|
|
+ double commit_valid_rate=0.0;
|
|
|
+ if(commit_times<=0){
|
|
|
+ commit_valid_rate = 0.0;
|
|
|
+ }else {
|
|
|
+ commit_valid_rate = (double) commit_valid_times/(double) commit_times;
|
|
|
+ }
|
|
|
double commitScore1 = 0.0,commitScore2 = 0.0,commitScore=0.0;
|
|
|
if(commit_times>=COMMIT_TIME_PER){
|
|
|
commitScore1 = 100;
|
|
|
@@ -281,12 +315,20 @@ public class DevcloudScoreServiceImpl implements DevcloudScoreService {
|
|
|
commitScore2 = commit_valid_rate/COMMIT_VALID_RATE * 100;
|
|
|
}
|
|
|
commitScore = (commitScore1+commitScore2)/2;
|
|
|
+// System.out.println(commit_times);
|
|
|
+// System.out.println(user_id+": "+commit_valid_rate);
|
|
|
+// System.out.println(user_id+": "+commitScore1+" and "+commitScore2);
|
|
|
formatScore.setCommitScore(commitScore);
|
|
|
|
|
|
//bugList
|
|
|
int bug_times = formatStudent.getBuglist().getBug_times();
|
|
|
int bug_finished_times = formatStudent.getBuglist().getFinished_times();
|
|
|
- double bug_finished_rate = (double)bug_finished_times/(double)bug_times;
|
|
|
+ double bug_finished_rate = 0.0;
|
|
|
+ if(bug_times<=0){
|
|
|
+ bug_finished_rate = 0.0;
|
|
|
+ }else {
|
|
|
+ bug_finished_rate = (double)bug_finished_times/(double)bug_times;
|
|
|
+ }
|
|
|
double bugScore1=0.0,bugScore2=0.0,bugScore=0.0;
|
|
|
if(bug_times>=BUG_TIME_PER){
|
|
|
bugScore1 = 100;
|
|
|
@@ -304,7 +346,12 @@ public class DevcloudScoreServiceImpl implements DevcloudScoreService {
|
|
|
//nodeList
|
|
|
int treeNode_times = formatStudent.getTreeNode().getTreeNode_times();
|
|
|
int treeNode_finished_times = formatStudent.getTreeNode().getFinished_treeNode_times();
|
|
|
- double treeNode_finished_rate = (double) treeNode_finished_times/ (double) treeNode_times;
|
|
|
+ double treeNode_finished_rate = 0.0;
|
|
|
+ if(treeNode_times<=0){
|
|
|
+ treeNode_finished_rate = 0.0;
|
|
|
+ }else {
|
|
|
+ treeNode_finished_rate = (double)treeNode_finished_times/(double)treeNode_times;
|
|
|
+ }
|
|
|
double nodeScore1=0.0,nodeScore2=0.0,nodeScore=0.0;
|
|
|
if(treeNode_times>=NODE_TIME_PER){
|
|
|
nodeScore1 = 100;
|
|
|
@@ -322,7 +369,12 @@ public class DevcloudScoreServiceImpl implements DevcloudScoreService {
|
|
|
//pipeline
|
|
|
int pipeline_times = formatStudent.getPipeline().getPipeline_deploy();
|
|
|
int pipeline_success_times = formatStudent.getPipeline().getPipeline_pass();
|
|
|
- double pipeline_success_rate = (double)pipeline_success_times/(double)pipeline_times;
|
|
|
+ double pipeline_success_rate = 0.0;
|
|
|
+ if(pipeline_times<=0){
|
|
|
+ pipeline_success_rate = 0.0;
|
|
|
+ }else {
|
|
|
+ pipeline_success_rate = (double)pipeline_success_times/(double)pipeline_times;
|
|
|
+ }
|
|
|
double pipelineScore1=0.0,pipelineScore2=0.0,pipelineScore=0.0;
|
|
|
if(pipeline_times>=PIPELINE_TIME_PER){
|
|
|
pipelineScore1 = 100;
|