// nbBattles = nbBattles + battles;
// levelByBattles =levelByBattles + levelTank * battles;
// }
// averageLevelTank = levelByBattles/nbBattles;
DataCommunityAccountRatings myDataCommunityAccountRatings = communityAccount.getData();
//average level tank
myDataCommunityAccountRatings.setAverageLevel(averageLevelTank);
//log.info("averageLevelTank" + averageLevelTank);
//== WR calculated
int battles = myDataCommunityAccountRatings.getBattles();
int battlesWin = myDataCommunityAccountRatings.getBattle_wins();
Double wrCal = (double) ((double)battlesWin/(double)battles);
//on ne conserve que 2 digits après la virgule
wrCal = wrCal * 100; //ex : 51,844444
int intWrCal = (int) (wrCal * 100); //ex : 5184
wrCal = (double)intWrCal / 100 ; //ex : 51,84
myDataCommunityAccountRatings.setBattle_avg_performanceCalc(wrCal);
//== Ratio capture points calculated
int ctfPoints = myDataCommunityAccountRatings.getCtf_points();
Double ctfPointsCal = (double) ((double)ctfPoints/(double)battles);// 1,28 :1 = 1.28
//on ne conserve que 2 digits après la virgule
//ctfPointsCal = ctfPointsCal * 100; //ex : 1,2827
int intCtfPointsCal = (int) (ctfPointsCal * 100); //ex intCtfPointsCal : 128,27 ctfPointsCal = 1.28
ctfPointsCal = (double)intCtfPointsCal / 100 ; //ex ctfPointsCal : 1,28 intCtfPointsCal = 128
myDataCommunityAccountRatings.setRatioCtfPoints(ctfPointsCal);
//==Damage Ration calculated
int damagePoints = myDataCommunityAccountRatings.getDamage_dealt();
Double ratioDamagePoints = (double) ((double)damagePoints/(double)battles);
//on ne conserve que 2 digits après la virgule
//ctfPointsCal = ctfPointsCal * 100; //ex : 1,2827
int intRatioDamagePoints = (int) (ratioDamagePoints * 100); //ex : 128,27
ratioDamagePoints = (double)intRatioDamagePoints / 100 ; //ex : 1,28
myDataCommunityAccountRatings.setRatioDamagePoints(ratioDamagePoints);
//==Ratio Defense calculated
int droppedCtfPoints = myDataCommunityAccountRatings.getDropped_ctf_points();
Double ratioDroppedCtfPoints = (double) ((double)droppedCtfPoints/(double)battles);
//on ne conserve que 2 digits après la virgule
//ctfPointsCal = ctfPointsCal * 100; //ex : 1,2827
int intRatioDroppedCtfPoints = (int) (ratioDroppedCtfPoints * 100); //ex : 128,27
ratioDroppedCtfPoints = (double)intRatioDroppedCtfPoints / 100 ; //ex : 1,28
myDataCommunityAccountRatings.setRatioDroppedCtfPoints(ratioDroppedCtfPoints);
//==Ratio Destroyed calculated
int destroyedPoints = myDataCommunityAccountRatings.getFrags();
Double ratiodestroyedPoints = (double) ((double)destroyedPoints/(double)battles);
//on ne conserve que 2 digits après la virgule
//ctfPointsCal = ctfPointsCal * 100; //ex : 1,2827
int intRatiodestroyedPoints = (int) (ratiodestroyedPoints * 100); //ex : 128,27
ratiodestroyedPoints = (double)intRatiodestroyedPoints / 100 ; //ex : 1,28
myDataCommunityAccountRatings.setRatioDestroyedPoints(ratiodestroyedPoints);
//==Ratio Detected calculated
int detectedPoints = myDataCommunityAccountRatings.getSpotted();
Double ratioDetectedPoints = (double) ((double)detectedPoints/(double)battles);
//on ne conserve que 2 digits après la virgule
//ctfPointsCal = ctfPointsCal * 100; //ex : 1,2827
int intRatioDetectedPoints = (int) (ratioDetectedPoints * 100); //ex : 128,27
ratioDetectedPoints = (double)intRatioDetectedPoints / 100 ; //ex : 1,28
myDataCommunityAccountRatings.setRatioDetectedPoints(ratioDetectedPoints);
}
//add account
listCommunityAccount.addAll(listCommunityAccount1);