Skip to content

Commit

Permalink
Fix some sync bugs
Browse files Browse the repository at this point in the history
Fixes jasp-stats/jasp-test-release#2371

Fixes also:
. Open a csv file with JASP.
. Make a change in JASP: Sync icon turns off
. Undo: Sync icon stays off
. Click on Sync icon: it reloads the data: Sync icon turns on
. Change data in JASP: the Sync icon stays on: this is wrong. This is fixes by this PR.
.
  • Loading branch information
boutinb authored and JorisGoosen committed Nov 15, 2023
1 parent 687687f commit dd76f14
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Desktop/data/datasetpackage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1751,6 +1751,7 @@ void DataSetPackage::setColumnName(size_t columnIndex, const std::string & newNa
if(resetModel)
endResetModel();

setManualEdits(true);
emit datasetChanged({}, {}, QMap<QString, QString>({{tq(oldName), tq(newName)}}), false, false);
}

Expand Down Expand Up @@ -2674,7 +2675,8 @@ bool DataSetPackage::manualEdits() const

void DataSetPackage::setManualEdits(bool newManualEdits)
{
if (_manualEdits == newManualEdits)
// During synchronization, even if some data are changed, manualEdits should not be set to true
if ((_synchingData && newManualEdits) || _manualEdits == newManualEdits)
return;

_manualEdits = newManualEdits;
Expand Down
1 change: 1 addition & 0 deletions Desktop/data/importers/importer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ void Importer::syncDataSet(const std::string &locator, std::function<void(int)>
if (newColumns.size() > 0 || changedColumns.size() > 0 || missingColumns.size() > 0 || changeNameColumns.size() > 0 || rowCountChanged)
_syncPackage(importDataSet, newColumns, changedColumns, missingColumns, changeNameColumns, rowCountChanged);

DataSetPackage::pkg()->setManualEdits(false);
delete importDataSet;
}

Expand Down

0 comments on commit dd76f14

Please sign in to comment.