Skip to content

Commit

Permalink
Merge pull request #3202 from Navid200/Navid_2023_11_22
Browse files Browse the repository at this point in the history
Allow history to show all readings even for 1 reading per minute
  • Loading branch information
jamorham authored Nov 29, 2023
2 parents c67c8f6 + 38ca1ad commit bda62e3
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion app/src/main/java/com/eveningoutpost/dexdrip/BGHistory.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ public class BGHistory extends ActivityWithMenu {
private int noDays = 1;
private SharedPreferences prefs;
private TextView statisticsTextView;
private static final int SAMPLE_PERIOD = 1; // In minutes - The time between two consecutive readings - The lowest period we currently support: 1 minute
private static final int GRACE_READINGS_PER_DAY = 2; // When switching from one source to another, there may be a misalignment in sample timing resulting in more readings per day

@Override
protected void onCreate(Bundle savedInstanceState) {
Expand Down Expand Up @@ -148,7 +150,7 @@ private void setupCharts() {

Calendar endDate = (GregorianCalendar) date1.clone();
endDate.add(Calendar.DATE, noDays);
int numValues = noDays * (60 / 2) * 24; // LimiTTer sample rate 1 per 2 minutes
int numValues = noDays * (24 * (60 / SAMPLE_PERIOD) + GRACE_READINGS_PER_DAY); // The highest sample rate we currently support
BgGraphBuilder bgGraphBuilder = new BgGraphBuilder(this, date1.getTimeInMillis(), endDate.getTimeInMillis(), numValues, false);

chart = (LineChartView) findViewById(R.id.chart);
Expand Down

0 comments on commit bda62e3

Please sign in to comment.