From bdc006e924fb77e3ac85241752a70d1d6c56c7ec Mon Sep 17 00:00:00 2001 From: Patrick Linstruth Date: Thu, 2 May 2019 06:35:12 -0700 Subject: [PATCH] Fixed regression in scheduler when using two schedule codes. --- ChangeLog | 2 ++ lib/rdevent_line.cpp | 10 +++++++--- lib/rdschedcartlist.cpp | 6 ++++-- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5a5152d4..0daeb05b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -18632,3 +18632,5 @@ 2019-05-01 Fred Gleason * Fixed bugs in the 'Import' Web API call that caused import of filenames containing multibyte UTF-8 characters to fail. +2019-05-02 Patrick Linstruth + * Fixed regression in scheduler when using two schedule codes. diff --git a/lib/rdevent_line.cpp b/lib/rdevent_line.cpp index 31d4018a..de0f804a 100644 --- a/lib/rdevent_line.cpp +++ b/lib/rdevent_line.cpp @@ -656,7 +656,12 @@ bool RDEventLine::generateLog(QString logname,const QString &svcname, // Reduce schedCL to match requested scheduler code if(event_have_code!=""||event_have_code2!="") { QStringList codes; - codes << event_have_code << event_have_code2; + if(event_have_code!="") { + codes << event_have_code; + } + if(event_have_code2!="") { + codes << event_have_code2; + } for(counter=0;countergetNumberOfItems();counter++) { if(!schedCL->itemHasCodes(counter,codes)) { schedCL->removeItem(counter); @@ -890,8 +895,7 @@ bool RDEventLine::generateLog(QString logname,const QString &svcname, // // Pick a random cart from those that are remaining. // - int r=rand(); - int schedpos=r%schedCL->getNumberOfItems(); + int schedpos=rand()%schedCL->getNumberOfItems(); sql=QString("insert into LOG_LINES set ")+ "LOG_NAME=\""+RDEscapeString(logname)+"\","+ QString().sprintf("LINE_ID=%d,",count)+ diff --git a/lib/rdschedcartlist.cpp b/lib/rdschedcartlist.cpp index 56d06aae..c582bbeb 100644 --- a/lib/rdschedcartlist.cpp +++ b/lib/rdschedcartlist.cpp @@ -74,12 +74,14 @@ bool RDSchedCartList::itemHasCode(int itemnumber,const QString &test_code) bool RDSchedCartList::itemHasCodes(int itemnumber,const QStringList &test_codes) { + int matches=0; + for(int i=0;i