|
|
@ -122,13 +122,13 @@ public class NutrientScoreCalculation {
|
|
|
|
|
|
|
|
|
|
|
|
public static void main(String[] args) {
|
|
|
|
public static void main(String[] args) {
|
|
|
|
DataMap data = new DataMap();
|
|
|
|
DataMap data = new DataMap();
|
|
|
|
data.put("month", 24);
|
|
|
|
data.put("month", 11);
|
|
|
|
data.put("enerc", 855.44);
|
|
|
|
data.put("enerc", 855.44);
|
|
|
|
data.put("chotdf", 110.99);
|
|
|
|
data.put("chotdf", 110.99);
|
|
|
|
data.put("procnp", 27.25);
|
|
|
|
data.put("procnp", 27.25);
|
|
|
|
data.put("fat", 32.7);
|
|
|
|
data.put("fat", 32.7);
|
|
|
|
data.put("sugar", 53.8);
|
|
|
|
data.put("sugar", 53.8);
|
|
|
|
data.put("fibtg", 0.68);
|
|
|
|
data.put("fibtg", 40.68);
|
|
|
|
data.put("na", 227.31);
|
|
|
|
data.put("na", 227.31);
|
|
|
|
data.put("vitaminb1", 0.45);
|
|
|
|
data.put("vitaminb1", 0.45);
|
|
|
|
data.put("vitaminb2", 1.18);
|
|
|
|
data.put("vitaminb2", 1.18);
|
|
|
@ -399,7 +399,7 @@ public class NutrientScoreCalculation {
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
private double getFibtgValue(double x, double from, double to) {
|
|
|
|
private double getFibtgValue(double x, double from, double to) {
|
|
|
|
// 12개월 미만 아이에게는 식이섬유 판정 없음
|
|
|
|
// 12개월 미만 아이에게는 식이섬유 판정 없음
|
|
|
|
if(this.label<3) return 0;
|
|
|
|
if(this.label<2) return 0;
|
|
|
|
|
|
|
|
|
|
|
|
double result = 0;
|
|
|
|
double result = 0;
|
|
|
|
if(from*0.5>x)
|
|
|
|
if(from*0.5>x)
|
|
|
@ -412,7 +412,6 @@ public class NutrientScoreCalculation {
|
|
|
|
result = -100/(to*1.5-to)*x + 100/(to*1.5-to)*to*1.5;
|
|
|
|
result = -100/(to*1.5-to)*x + 100/(to*1.5-to)*to*1.5;
|
|
|
|
else if(to*1.5<x)
|
|
|
|
else if(to*1.5<x)
|
|
|
|
result = 0;
|
|
|
|
result = 0;
|
|
|
|
|
|
|
|
|
|
|
|
return Math.round(result*100)/100.0;
|
|
|
|
return Math.round(result*100)/100.0;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
@ -710,7 +709,12 @@ public class NutrientScoreCalculation {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private long getBasicNutrientsAvg() {
|
|
|
|
private long getBasicNutrientsAvg() {
|
|
|
|
double basicAvg = getBasicNutrientsScore()/7;
|
|
|
|
double basicAvg = 0;
|
|
|
|
|
|
|
|
if(label < 2) {
|
|
|
|
|
|
|
|
basicAvg = getBasicNutrientsScore()/6;
|
|
|
|
|
|
|
|
}else {
|
|
|
|
|
|
|
|
basicAvg = getBasicNutrientsScore()/7;
|
|
|
|
|
|
|
|
}
|
|
|
|
return Math.round(basicAvg);
|
|
|
|
return Math.round(basicAvg);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|