Bug #2498
open[Patch] Mutischedule: incoplete time axis when ScheduleDuration != 8
0%
Description
When ScheduleDuration is set to a value less than 8 hours the multischedule page can no longer access the entire time line. This is because the 8h steps is hard coded to multischedule.ecpp.
The following patch resolves the issue:
diff --git a/pages/multischedule.ecpp b/pages/multischedule.ecpp
index d4fca9d..0a80024 100644
--- a/pages/multischedule.ecpp
+++ b/pages/multischedule.ecpp@ -193,10 +193,20
@ std::vector<time_t> times_start;
tm_r.tm_sec=0;
time_t midnight = mktime( &tm_r );
- // add four 8h steps per day to the time list
- for (int i=0; i<4*MAX_DAYS ; i++ )
+ // add steps to the time list
+ time_t max_hours;
+ try {
+ max_hours = lexical_cast<time_t>( LiveSetup().GetScheduleDuration() );
+ }
+ catch ( const bad_lexical_cast & )
+ {
+ esyslog("Live: could not convert '%s' into a schedule duration", LiveSe$
+ max_hours = 8;
+ };
for (int i=0; i<24*MAX_DAYS/max_hours ; i++ )
{
- times_start.push_back( midnight + MAX_HOURS*3600*i );
+ times_start.push_back( midnight + max_hours*3600*i );
}
vector< string > parts = StringSplit( LiveSetup().GetTimes(), ';' );
vector< time_t > offsets;