[med-svn] [aghermann] 07/14: ensure there is at least one hour in overview profile

andrei zavada hmmr-guest at moszumanska.debian.org
Sat Jan 30 18:16:02 UTC 2016


This is an automated email from the git hooks/post-receive script.

hmmr-guest pushed a commit to branch WIP
in repository aghermann.

commit c580fb28a2f49f7f242007148058e2d4c8aa1311
Author: Andrei Zavada <hmmr at asium>
Date:   Sat Nov 21 13:02:32 2015 +0200

    ensure there is at least one hour in overview profile
---
 upstream/src/aghermann/ui/mw/measurements_cb.cc |  3 ++-
 upstream/src/aghermann/ui/mw/populate.cc        | 12 ++++++++----
 2 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/upstream/src/aghermann/ui/mw/measurements_cb.cc b/upstream/src/aghermann/ui/mw/measurements_cb.cc
index 1fcbac1..19fea62 100644
--- a/upstream/src/aghermann/ui/mw/measurements_cb.cc
+++ b/upstream/src/aghermann/ui/mw/measurements_cb.cc
@@ -146,7 +146,8 @@ daSubjectTimeline_scroll_event_cb(
                 default: break;
                 }
 
-                ED.tl_width = (ED.timeline_end - ED.timeline_start) / 3600 * ED.tl_pph;
+                auto hours = (ED.timeline_end - ED.timeline_start) / 3600;
+                ED.tl_width = (hours < 1 ? 1 : hours) * ED.tl_pph;
                 for ( auto &G : ED.groups )
                         for ( auto &J : G )
                                 g_object_set(
diff --git a/upstream/src/aghermann/ui/mw/populate.cc b/upstream/src/aghermann/ui/mw/populate.cc
index 93e0672..f47b73f 100644
--- a/upstream/src/aghermann/ui/mw/populate.cc
+++ b/upstream/src/aghermann/ui/mw/populate.cc
@@ -445,10 +445,14 @@ populate_1()
 
         timeline_start = earliest_start;
         timeline_end   = latest_end;
-        tl_width = (timeline_end - timeline_start) / 3600 * tl_pph;
-        tl_pages = (timeline_end - timeline_start) / ED->psd_params.pagesize;
-
-        APPLOG_INFO ("populate_1(): common timeline:");
+        decltype(timeline_end) full_secs =
+                timeline_end - timeline_start;
+        if ( full_secs < 3600 )
+                full_secs = 3600;
+        tl_width = full_secs * tl_pph;
+        tl_pages = full_secs / ED->psd_params.pagesize;
+
+        APPLOG_INFO ("populate_1(): common timeline is %zu pages:", tl_pages);
         {
                 string t {asctime( localtime(&earliest_start))};
                 t += asctime( localtime(&latest_end));

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/aghermann.git



More information about the debian-med-commit mailing list