2018-03-14 00:57:48 +01:00
|
|
|
package info.nightscout.androidaps.db;
|
|
|
|
|
2019-04-10 17:24:16 +02:00
|
|
|
import com.j256.ormlite.field.DatabaseField;
|
|
|
|
import com.j256.ormlite.table.DatabaseTable;
|
|
|
|
|
2018-03-14 00:57:48 +01:00
|
|
|
import org.slf4j.Logger;
|
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
|
2018-07-30 15:46:20 +02:00
|
|
|
import info.nightscout.androidaps.logging.L;
|
2019-06-23 01:01:11 +02:00
|
|
|
import info.nightscout.androidaps.plugins.pump.common.utils.DateTimeUtil;
|
2018-07-30 15:46:20 +02:00
|
|
|
|
2018-03-14 00:57:48 +01:00
|
|
|
/**
|
|
|
|
* Created by mike on 20.09.2017.
|
|
|
|
*/
|
|
|
|
|
2019-04-10 17:24:16 +02:00
|
|
|
|
2018-03-14 00:57:48 +01:00
|
|
|
@DatabaseTable(tableName = DatabaseHelper.DATABASE_TDDS)
|
|
|
|
public class TDD {
|
2018-07-30 15:46:20 +02:00
|
|
|
private static Logger log = LoggerFactory.getLogger(L.DATABASE);
|
2018-03-14 00:57:48 +01:00
|
|
|
|
|
|
|
@DatabaseField(id = true)
|
|
|
|
public long date;
|
|
|
|
|
|
|
|
@DatabaseField
|
|
|
|
public double bolus;
|
|
|
|
|
|
|
|
@DatabaseField
|
|
|
|
public double basal;
|
|
|
|
|
|
|
|
@DatabaseField
|
|
|
|
public double total;
|
|
|
|
|
|
|
|
|
2019-04-10 17:24:16 +02:00
|
|
|
public double getTotal(){
|
|
|
|
return (total > 0d) ? total:(bolus+basal);
|
2018-03-14 00:57:48 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-04-10 17:24:16 +02:00
|
|
|
public TDD() { }
|
2018-03-14 00:57:48 +01:00
|
|
|
|
2019-07-13 20:15:44 +02:00
|
|
|
public TDD(long date, double bolus, double basal, double total){
|
2018-03-14 00:57:48 +01:00
|
|
|
this.date = date;
|
|
|
|
this.bolus = bolus;
|
|
|
|
this.basal = basal;
|
|
|
|
this.total = total;
|
|
|
|
}
|
2019-06-23 01:01:11 +02:00
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public String toString() {
|
|
|
|
return "TDD [" +
|
|
|
|
"date=" + date +
|
|
|
|
"date(str)=" + DateTimeUtil.toStringFromTimeInMillis(date) +
|
|
|
|
", bolus=" + bolus +
|
|
|
|
", basal=" + basal +
|
|
|
|
", total=" + total +
|
|
|
|
']';
|
|
|
|
}
|
2019-07-13 20:15:44 +02:00
|
|
|
}
|