박권수

Merge branch 'server' into web

......@@ -12,9 +12,10 @@ const TakeMedicineHistorySchema = new Schema ({
ref : 'BottleMedicine',
required : true,
},
temperature : { type : Number, default : 0 },
humidity : { type : Number, default : 0 },
dosage : { type : Number, default : 0 },
temperature : { type : Number, default : 0, },
humidity : { type : Number, default : 0, },
dosage : { type : Number, default : 0, },
balance : { type : Number, default : 0, },
});
......
......@@ -59,11 +59,14 @@ const bottleInfoUpdate = async(data) => {
const dosage = Math.round((lastTotalWeight - totalWeight) / parseFloat(eachWeight));
if(dosage > 0) {
const balance = Math.round(totalWeight / parseFloat(eachWeight));
const takeMedicineHist = new TakeMedicineHist({
bmId : bottleMedicine._id,
temperature,
humidity,
dosage,
balance,
});
await takeMedicineHist.save();
}
......