mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-10-11 17:13:47 +02:00
Fixed title separation in rdlogmanager(1) scheduler.
Added a 'STACK_LINES.TITLE' field to the database. Incremented the database version to 347.
This commit is contained in:
@@ -24,7 +24,7 @@
|
||||
/*
|
||||
* Current Database Version
|
||||
*/
|
||||
#define RD_VERSION_DATABASE 346
|
||||
#define RD_VERSION_DATABASE 347
|
||||
|
||||
|
||||
#endif // DBVERSION_H
|
||||
|
@@ -591,7 +591,7 @@ bool RDEventLine::generateLog(QString logname,const QString &svcname,
|
||||
//
|
||||
// Load all carts in requested group into schedCL
|
||||
//
|
||||
sql=QString("select NUMBER,ARTIST,")+
|
||||
sql=QString("select NUMBER,ARTIST,TITLE,")+
|
||||
"CONCAT(GROUP_CONCAT(RPAD(SC.SCHED_CODE,11,' ') separator ''),'.') as SCHED_CODES"+
|
||||
" from CART LEFT JOIN CART_SCHED_CODES AS SC on (NUMBER=SC.CART_NUMBER)"+
|
||||
" where GROUP_NAME='"+RDEscapeString(schedGroup())+"'"+
|
||||
@@ -599,12 +599,12 @@ bool RDEventLine::generateLog(QString logname,const QString &svcname,
|
||||
RDSchedCartList *schedCL=new RDSchedCartList();
|
||||
q=new RDSqlQuery(sql);
|
||||
while(q->next()) {
|
||||
QStringList codes=q->value(2).toString().split(" ",QString::SkipEmptyParts);
|
||||
QStringList codes=q->value(3).toString().split(" ",QString::SkipEmptyParts);
|
||||
if((codes.size()>0)&&(codes.last()==".")) {
|
||||
codes.removeLast();
|
||||
}
|
||||
schedCL->
|
||||
insertItem(q->value(0).toUInt(),0,0,q->value(1).toString(),codes);
|
||||
insertItem(q->value(0).toUInt(),0,0,q->value(1).toString(),q->value(2).toString(),codes);
|
||||
}
|
||||
delete q;
|
||||
|
||||
@@ -636,17 +636,17 @@ bool RDEventLine::generateLog(QString logname,const QString &svcname,
|
||||
// Title separation
|
||||
//
|
||||
// Iterate through schedCL and remove carts from schedCL that
|
||||
// match cart number on the stack essentially removing matched titles.
|
||||
// match title on the stack.
|
||||
//
|
||||
if(titlesep>=0) {
|
||||
schedCL->save();
|
||||
sql=QString("select CART from STACK_LINES where ")+
|
||||
sql=QString("select TITLE from STACK_LINES where ")+
|
||||
"SERVICE_NAME=\""+RDEscapeString(svcname)+"\" && "+
|
||||
QString().sprintf("SCHED_STACK_ID >= %d",stackid-titlesep);
|
||||
q=new RDSqlQuery(sql);
|
||||
while (q->next()) {
|
||||
for(counter=0;counter<schedCL->getNumberOfItems();counter++) {
|
||||
if(q->value(0).toUInt()==schedCL->getItemCartNumber(counter)) {
|
||||
if(q->value(0).toString()==schedCL->getItemTitle(counter)) {
|
||||
schedCL->removeItem(counter);
|
||||
counter--;
|
||||
}
|
||||
@@ -859,7 +859,8 @@ bool RDEventLine::generateLog(QString logname,const QString &svcname,
|
||||
"SCHEDULED_AT=now(),"+
|
||||
QString().sprintf("SCHED_STACK_ID=%u,",stackid)+
|
||||
QString().sprintf("CART=%u,",schedCL->getItemCartNumber(schedpos))+
|
||||
"ARTIST=\""+RDEscapeString(schedCL->getItemArtist(schedpos))+"\"";
|
||||
"ARTIST=\""+RDEscapeString(schedCL->getItemArtist(schedpos))+"\","+
|
||||
"TITLE=\""+RDEscapeString(schedCL->getItemTitle(schedpos))+"\"";
|
||||
unsigned line_id=RDSqlQuery::run(sql).toUInt();
|
||||
QStringList codes=schedCL->getItemSchedCodes(schedpos);
|
||||
for(int i=0;i<codes.size();i++) {
|
||||
|
@@ -29,12 +29,14 @@ RDSchedCartList::RDSchedCartList()
|
||||
|
||||
void RDSchedCartList::insertItem(unsigned cartnumber,int cartlength,int stack_id,
|
||||
const QString &stack_artist,
|
||||
const QString &stack_title,
|
||||
const QStringList &stack_schedcodes)
|
||||
{
|
||||
list_cartnum.push_back(cartnumber);
|
||||
list_cartlen.push_back(cartlength);
|
||||
list_stackid.push_back(stack_id);
|
||||
list_artist.push_back(stack_artist.lower().replace(" ",""));
|
||||
list_title.push_back(stack_title.lower().replace(" ",""));
|
||||
list_schedcodes.push_back(stack_schedcodes);
|
||||
}
|
||||
|
||||
@@ -45,6 +47,7 @@ void RDSchedCartList::removeItem(int itemnumber)
|
||||
list_cartlen.removeAt(itemnumber);
|
||||
list_stackid.removeAt(itemnumber);
|
||||
list_artist.removeAt(itemnumber);
|
||||
list_title.removeAt(itemnumber);
|
||||
list_schedcodes.removeAt(itemnumber);
|
||||
}
|
||||
|
||||
@@ -58,6 +61,7 @@ bool RDSchedCartList::removeIfCode(int itemnumber,const QString &test_code)
|
||||
list_cartlen.removeAt(i);
|
||||
list_stackid.removeAt(i);
|
||||
list_artist.removeAt(i);
|
||||
list_title.removeAt(i);
|
||||
list_schedcodes.removeAt(i);
|
||||
matched=true;
|
||||
}
|
||||
@@ -91,6 +95,7 @@ void RDSchedCartList::save(void)
|
||||
list_savecartlen=list_cartlen;
|
||||
list_savestackid=list_stackid;
|
||||
list_saveartist=list_artist;
|
||||
list_savetitle=list_title;
|
||||
list_saveschedcodes=list_schedcodes;
|
||||
}
|
||||
|
||||
@@ -101,6 +106,7 @@ void RDSchedCartList::restore(void)
|
||||
list_cartlen=list_savecartlen;
|
||||
list_stackid=list_savestackid;
|
||||
list_artist=list_saveartist;
|
||||
list_title=list_savetitle;
|
||||
list_schedcodes=list_saveschedcodes;
|
||||
}
|
||||
|
||||
@@ -123,6 +129,12 @@ QString RDSchedCartList::getItemArtist(int itemnumber)
|
||||
}
|
||||
|
||||
|
||||
QString RDSchedCartList::getItemTitle(int itemnumber)
|
||||
{
|
||||
return list_title.at(itemnumber);
|
||||
}
|
||||
|
||||
|
||||
QStringList RDSchedCartList::getItemSchedCodes(int itemnumber)
|
||||
{
|
||||
return list_schedcodes.at(itemnumber);
|
||||
|
@@ -31,6 +31,7 @@ class RDSchedCartList
|
||||
RDSchedCartList();
|
||||
void insertItem(unsigned cartnumber,int cartlength,int stack_id,
|
||||
const QString &stack_artist,
|
||||
const QString &stack_title,
|
||||
const QStringList &stack_schedcodes);
|
||||
void removeItem(int itemnumber);
|
||||
bool removeIfCode(int itemnumber,const QString &test_code);
|
||||
@@ -40,6 +41,7 @@ class RDSchedCartList
|
||||
int getItemCartLength(int itemnumber);
|
||||
int getItemStackid(int itemnumber);
|
||||
QString getItemArtist(int itemnumber);
|
||||
QString getItemTitle(int itemnumber);
|
||||
QStringList getItemSchedCodes(int itemnumber);
|
||||
int getNumberOfItems(void);
|
||||
void save(void);
|
||||
@@ -53,7 +55,9 @@ class RDSchedCartList
|
||||
QList<int> list_stackid;
|
||||
QList<int> list_savestackid;
|
||||
QStringList list_artist;
|
||||
QStringList list_title;
|
||||
QStringList list_saveartist;
|
||||
QStringList list_savetitle;
|
||||
QList<QStringList> list_schedcodes;
|
||||
QList<QStringList> list_saveschedcodes;
|
||||
};
|
||||
|
Reference in New Issue
Block a user