@@ -568,7 +568,7 @@ columnType Column::setValues(size_t rows, const std::function<std::string(size_t
568568 {
569569 const std::string value = valueLookup (i),
570570 label = labelLookup (i);
571-
571+
572572 if (setValue (i, value, label, false , useLocale) && aChange)
573573 (*aChange) = true ;
574574
@@ -634,28 +634,17 @@ bool Column::overwriteDataAndType(stringvec colData, columnType colType)
634634{
635635 JASPTIMER_SCOPE (Column::overwriteDataAndType);
636636
637- if (computeFilter () != " " )
638- {
639- Filter theFilter (data (), computeFilter (), false );
640-
641- const boolvec & filtered = theFilter.filtered ();
642- stringvec newData;
643- newData . reserve (filtered.size ());
644-
645- for (size_t iFilter=0 , iData=0 ; iFilter < filtered.size () && iData < colData.size (); iFilter++)
646- newData.push_back (filtered[iFilter] ? colData[iData++] : " " );
647-
648- colData = newData;
649- }
650- else if (colData.size () == data ()->shownFilter ()->filteredRowCount ())
651- {
652- const boolvec & filtered = data ()->shownFilter ()->filtered ();
653- stringvec newData;
654- newData . reserve (filtered.size ());
655-
656-
657- colData = newData;
658- }
637+ assert (data ()->shownFilter ()->name () == computeFilter ());
638+
639+ const boolvec & filtered = data ()->shownFilter ()->filtered ();
640+ stringvec newData;
641+ newData . reserve (filtered.size ());
642+
643+ for (size_t iFilter=0 , iData=0 ; iFilter < filtered.size () && iData < colData.size (); iFilter++)
644+ newData.push_back (filtered[iFilter] ? colData[iData++] : " " );
645+
646+ colData = newData;
647+
659648
660649 // Now to make sure that the colData is neither bigger nor smaller than the dataset:
661650 colData.resize (data ()->rowCount ()); // Either add blanks rows add end or drop superfluous data
@@ -1326,7 +1315,7 @@ doublevec Column::dataAsRDoubles(const boolvec &filter) const
13261315 if (!useFilter || filter[row])
13271316 {
13281317 Label * l = labelByRow (row);
1329- doubles.push_back (!l->isEmptyValue () ? l->originalValueAsDouble () : EmptyValues::missingValueDouble);
1318+ doubles.push_back (l && !l->isEmptyValue () ? l->originalValueAsDouble () : EmptyValues::missingValueDouble);
13301319 }
13311320
13321321 return doubles;
@@ -1525,7 +1514,7 @@ bool Column::setStringValue(size_t row, const std::string & userEntered, const s
15251514
15261515 if (label && label->isEmptyValue ()) return false ;
15271516 if (cur == " " ) return false ;
1528- else return setValue (row, EmptyValues::missingValueDouble , writeToDB);
1517+ else return setValue (row, EmptyValues::missingValueInteger , writeToDB);
15291518 }
15301519
15311520 double newDoubleToSet = EmptyValues::missingValueDouble;
@@ -1556,7 +1545,7 @@ bool Column::setValue(size_t row, std::string value, const std::string & label,
15561545 // if both are "" we just want to clear the cell
15571546 // the assumption is that this is not direct user-input, but internal jasp stuff.
15581547 if (value == " " && label == " " )
1559- return setValue (row, EmptyValues::missingValueDouble , writeToDB);
1548+ return setValue (row, EmptyValues::missingValueInteger , writeToDB);
15601549
15611550 double newDoubleToSet = EmptyValues::missingValueDouble;
15621551 bool itsADouble = ColumnUtils::getDoubleValue (value, newDoubleToSet, useLocale);
@@ -1569,7 +1558,6 @@ bool Column::setValue(size_t row, std::string value, const std::string & label,
15691558
15701559 Label * newLabel = justAValue ? labelByValue (value) : labelByValueAndDisplay (value, label);
15711560
1572-
15731561 if (!newLabel)
15741562 newLabel = labelByIntsId (labelsAdd ((justAValue || labelIsValue) ? value : label, " " , itsADouble ? Json::Value (newDoubleToSet) : value));
15751563
@@ -2359,7 +2347,7 @@ stringvec Column::previewTransform(columnType transformType)
23592347
23602348bool Column::initFromLookups (const std::string & newName, size_t rows, const std::function<std::string(size_t )> valueLookup, const std::function<std::string(size_t )> labelLookup, const std::string & title, columnType desiredType, const stringset & emptyValues, int threshold, bool orderLabelsByValue, bool leaveBatchedUnfinished)
23612349
2362- {
2350+ {
23632351 setHasCustomEmptyValues (emptyValues.size ());
23642352 setCustomEmptyValues (emptyValues);
23652353 setName (newName);
0 commit comments