mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-12-20 15:41:23 +01:00
Fixed regression in rdlibrary(1) where matching count and background color codes were inaccurate.
This commit is contained in:
@@ -1194,7 +1194,8 @@ void MainWidget::RefreshCuts(RDListViewItem *p,unsigned cartnum)
|
||||
QString sql;
|
||||
QDateTime current_datetime(QDate::currentDate(),QTime::currentTime());
|
||||
QDateTime end_datetime;
|
||||
RDCart::Validity validity=RDCart::NeverValid;
|
||||
RDCart::Validity cart_validity=RDCart::NeverValid;
|
||||
RDCart::Validity cut_validity=RDCart::NeverValid;
|
||||
|
||||
while ((i=p->firstChild())) {
|
||||
delete i;
|
||||
@@ -1242,11 +1243,24 @@ void MainWidget::RefreshCuts(RDListViewItem *p,unsigned cartnum)
|
||||
else {
|
||||
l->setText(End,"TFN");
|
||||
}
|
||||
validity=ValidateCut(q,5,validity,current_datetime);
|
||||
end_datetime=q->value(8).toDateTime();
|
||||
UpdateItemColor(l,validity,end_datetime,current_datetime);
|
||||
cut_validity=ValidateCut(q,5,RDCart::NeverValid,current_datetime);
|
||||
UpdateItemColor(l,cut_validity,end_datetime,current_datetime);
|
||||
cart_validity=ValidateCut(q,5,cart_validity,current_datetime);
|
||||
UpdateItemColor(p,cart_validity,end_datetime,current_datetime);
|
||||
}
|
||||
}
|
||||
else if(q->size()==1){
|
||||
if(q->next()) {
|
||||
cart_validity=ValidateCut(q,5,cart_validity,current_datetime);
|
||||
end_datetime=q->value(8).toDateTime();
|
||||
UpdateItemColor(p,cart_validity,end_datetime,current_datetime);
|
||||
}
|
||||
}
|
||||
else {
|
||||
p->setBackgroundColor(RD_CART_ERROR_COLOR);
|
||||
}
|
||||
|
||||
delete q;
|
||||
}
|
||||
|
||||
@@ -1257,8 +1271,6 @@ void MainWidget::RefreshList()
|
||||
RDListViewItem *l=NULL;
|
||||
QString type_filter;
|
||||
QDateTime current_datetime(QDate::currentDate(),QTime::currentTime());
|
||||
unsigned cartnum=0;
|
||||
RDCart::Validity validity=RDCart::NeverValid;
|
||||
QDateTime end_datetime;
|
||||
|
||||
lib_cart_list->clear();
|
||||
@@ -1296,57 +1308,26 @@ void MainWidget::RefreshList()
|
||||
"CART.VALIDITY,"+ // 22
|
||||
"GROUPS.COLOR,"+ // 23
|
||||
"CUTS.TALK_START_POINT,"+ // 24
|
||||
"CUTS.TALK_END_POINT,"+ // 25
|
||||
"CUTS.LENGTH,"+ // 26 offsets begin here
|
||||
"CUTS.EVERGREEN,"+ // 27
|
||||
"CUTS.START_DATETIME,"+ // 28
|
||||
"CUTS.END_DATETIME,"+ // 29
|
||||
"CUTS.START_DAYPART,"+ // 30
|
||||
"CUTS.END_DAYPART,"+ // 31
|
||||
"CUTS.MON,"+ // 32
|
||||
"CUTS.TUE,"+ // 33
|
||||
"CUTS.WED,"+ // 34
|
||||
"CUTS.THU,"+ // 35
|
||||
"CUTS.FRI,"+ // 36
|
||||
"CUTS.SAT,"+ // 37
|
||||
"CUTS.SUN "+ // 38
|
||||
"CUTS.TALK_END_POINT "+ // 25
|
||||
"from CART left join GROUPS on CART.GROUP_NAME=GROUPS.NAME "+
|
||||
"left join CUTS on CART.NUMBER=CUTS.CART_NUMBER";
|
||||
sql+=WhereClause();
|
||||
sql+=" order by CART.NUMBER";
|
||||
sql+=" group by CART.NUMBER order by CART.NUMBER";
|
||||
if(lib_showmatches_box->isChecked()) {
|
||||
sql+=QString().sprintf(" limit %d",RD_LIMITED_CART_SEARCH_QUANTITY);
|
||||
}
|
||||
q=new RDSqlQuery(sql);
|
||||
int step=0;
|
||||
int count=0;
|
||||
int matches=0;
|
||||
lib_progress_dialog->setTotalSteps(q->size()/RDLIBRARY_STEP_SIZE);
|
||||
lib_progress_dialog->setProgress(0);
|
||||
while(q->next()) {
|
||||
end_datetime=q->value(14).toDateTime();
|
||||
if(q->value(0).toUInt()==cartnum) {
|
||||
if((RDCart::Type)q->value(15).toUInt()==RDCart::Macro) {
|
||||
validity=RDCart::AlwaysValid;
|
||||
}
|
||||
else {
|
||||
validity=ValidateCut(q,26,validity,current_datetime);
|
||||
}
|
||||
}
|
||||
else {
|
||||
//
|
||||
// Write availability color
|
||||
//
|
||||
UpdateItemColor(l,validity,q->value(14).toDateTime(),current_datetime);
|
||||
|
||||
//
|
||||
// Start a new entry
|
||||
//
|
||||
if((RDCart::Type)q->value(15).toUInt()==RDCart::Macro) {
|
||||
validity=RDCart::AlwaysValid;
|
||||
}
|
||||
else {
|
||||
validity=ValidateCut(q,26,RDCart::NeverValid,current_datetime);
|
||||
}
|
||||
l=new RDListViewItem(lib_cart_list);
|
||||
l->setExpandable(false);
|
||||
switch((RDCart::Type)q->value(15).toUInt()) {
|
||||
@@ -1418,21 +1399,18 @@ void MainWidget::RefreshList()
|
||||
l->setTextColor(Length,QColor(Qt::black),QFont::Normal);
|
||||
}
|
||||
}
|
||||
if(q->value(16).toUInt() > 1) {
|
||||
RefreshCuts(l,q->value(0).toUInt());
|
||||
}
|
||||
matches++;
|
||||
count++;
|
||||
}
|
||||
cartnum=q->value(0).toUInt();
|
||||
|
||||
if(count>RDLIBRARY_STEP_SIZE) {
|
||||
lib_progress_dialog->setProgress(++step);
|
||||
count=0;
|
||||
qApp->processEvents(QEventLoop::ExcludeUserInputEvents);
|
||||
}
|
||||
}
|
||||
lib_matches_edit->setText(QString().sprintf("%d",count));
|
||||
UpdateItemColor(l,validity,end_datetime,current_datetime);
|
||||
lib_progress_dialog->reset();
|
||||
lib_matches_edit->setText(QString().sprintf("%d",matches));
|
||||
delete q;
|
||||
}
|
||||
|
||||
@@ -1510,32 +1488,14 @@ void MainWidget::RefreshLine(RDListViewItem *item)
|
||||
"CART.VALIDITY,"+ // 21
|
||||
"GROUPS.COLOR,"+ // 22
|
||||
"CUTS.TALK_START_POINT,"+ // 23
|
||||
"CUTS.TALK_END_POINT,"+ // 24
|
||||
"CUTS.LENGTH,"+ // 25 offsets begin here
|
||||
"CUTS.EVERGREEN,"+ // 26
|
||||
"CUTS.START_DATETIME,"+ // 27
|
||||
"CUTS.END_DATETIME,"+ // 28
|
||||
"CUTS.START_DAYPART,"+ // 29
|
||||
"CUTS.END_DAYPART,"+ // 30
|
||||
"CUTS.MON,"+ // 31
|
||||
"CUTS.TUE,"+ // 32
|
||||
"CUTS.WED,"+ // 33
|
||||
"CUTS.THU,"+ // 34
|
||||
"CUTS.FRI,"+ // 35
|
||||
"CUTS.SAT,"+ // 35
|
||||
"CUTS.SUN "+ // 37
|
||||
"CUTS.TALK_END_POINT "+ // 24
|
||||
"from CART left join GROUPS "+
|
||||
"on CART.GROUP_NAME=GROUPS.NAME left join CUTS on "+
|
||||
"CART.NUMBER=CUTS.CART_NUMBER where "+
|
||||
QString().sprintf("CART.NUMBER=%u",item->text(Cart).toUInt());
|
||||
QString().sprintf("CART.NUMBER=%u ",item->text(Cart).toUInt())+
|
||||
"group by CART.NUMBER";
|
||||
RDSqlQuery *q=new RDSqlQuery(sql);
|
||||
while(q->next()) {
|
||||
if((RDCart::Type)q->value(14).toUInt()==RDCart::Macro) {
|
||||
validity=RDCart::AlwaysValid;
|
||||
}
|
||||
else {
|
||||
validity=ValidateCut(q,25,validity,current_datetime);
|
||||
}
|
||||
switch((RDCart::Type)q->value(14).toUInt()) {
|
||||
case RDCart::Audio:
|
||||
if(q->value(20).isNull()) {
|
||||
@@ -1544,7 +1504,7 @@ void MainWidget::RefreshLine(RDListViewItem *item)
|
||||
else {
|
||||
item->setPixmap(Icon,*lib_track_cart_map);
|
||||
}
|
||||
if(q->value(Icon).toUInt()==0) {
|
||||
if(q->value(0).toUInt()==0) {
|
||||
item->setBackgroundColor(RD_CART_ERROR_COLOR);
|
||||
}
|
||||
else {
|
||||
|
||||
Reference in New Issue
Block a user