Skip to content

Commit

Permalink
Fix bug where having empty values messes up labeledits (jasp-stats#5666)
Browse files Browse the repository at this point in the history
* Fix bug where having empty values messes up labeledits

This is done by resetting labelsTemp

* properly index in the labels
  • Loading branch information
JorisGoosen authored Sep 24, 2024
1 parent 13ce3f6 commit d474dca
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
6 changes: 1 addition & 5 deletions CommonData/column.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1213,7 +1213,7 @@ std::map<double, Label*> Column::replaceDoubleWithLabel(doublevec dbls)
if(!std::isnan(_dbls[r]) && doubleIntIdMap.count(_dbls[r]))
_ints[r] = doubleIntIdMap[_dbls[r]];

dbUpdateValues();
dbUpdateValues(false);

return doubleLabelMap;
}
Expand All @@ -1226,7 +1226,6 @@ Label *Column::replaceDoublesTillLabelsRowWithLabels(size_t row)
if(labelByIndexNotEmpty(row))
return labelByIndexNotEmpty(row);

bool labelsTempUpToDate = _revision == _labelsTempRevision; //If so we can just update it at the end. We dont not yet need to recreate them
doublevec dbls;
double dbl;

Expand All @@ -1242,9 +1241,6 @@ Label *Column::replaceDoublesTillLabelsRowWithLabels(size_t row)
//the last dbl is the one we want so use it to get the right label from the map:
Label * label = replaceDoubleWithLabel(dbls)[dbl];

if(labelsTempUpToDate)
_labelsTempRevision = _revision;

return label;
}

Expand Down
5 changes: 3 additions & 2 deletions Desktop/data/datasetpackage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -250,8 +250,9 @@ QModelIndex DataSetPackage::index(int row, int column, const QModelIndex &parent

case dataSetBaseNodeType::column:
{
Column * col = dynamic_cast<Column*>(parentNode);
pointer = dynamic_cast<const void*>(col->labels().size() > row ? col->labels()[row] : col->labelDoubleDummy());
Column * col = dynamic_cast<Column*>(parentNode);
Label * lab = col->labelByIndexNotEmpty(row);
pointer = dynamic_cast<const void*>(lab ? lab : col->labelDoubleDummy());
break;
}

Expand Down

0 comments on commit d474dca

Please sign in to comment.