Fixed regression in scheduler when using two schedule codes.

This commit is contained in:
Patrick Linstruth 2019-05-02 06:35:12 -07:00
parent b0e92a7899
commit bdc006e924
3 changed files with 13 additions and 5 deletions

View File

@ -18632,3 +18632,5 @@
2019-05-01 Fred Gleason <fredg@paravelsystems.com>
* 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 <patrick@deltecent.com>
* Fixed regression in scheduler when using two schedule codes.

View File

@ -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;counter<schedCL->getNumberOfItems();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)+

View File

@ -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<test_codes.size();i++) {
if(itemHasCode(itemnumber,test_codes.at(i))) {
return true;
matches++;
}
}
return false;
return(matches==test_codes.size());
}