Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delete a measure, re-add it from library: no prompt and duplicated folders #115

Closed
jmarrec opened this issue Jan 10, 2017 · 7 comments · Fixed by #720
Closed

Delete a measure, re-add it from library: no prompt and duplicated folders #115

jmarrec opened this issue Jan 10, 2017 · 7 comments · Fixed by #720

Comments

@jmarrec
Copy link
Collaborator

jmarrec commented Jan 10, 2017

System info:

  • Sketchup 2016
  • macOS Sierra 10.12.2
  • OpenStudio 2.0.0 (47ba3cbe19)

There seem to be a small bug that you might have noticed too with Measures on mac (aside from not telling you it’s broken and not giving you any message that can help), where you delete a measure and re-add it from library

  1. It doesn’t ask anything (no "Update all previous reference to measure?" or something)
  2. You end up with a new folder named “Measure blablabla 1", as you redo that it can get quite huge

In model/measures:

screen shot 2017-01-10 at 17 27 09

@asparke2
Copy link
Contributor

@jmarrec is this inside of a PAT project, an OS App model, your My Measures directory, or somewhere else?

@jmarrec
Copy link
Collaborator Author

jmarrec commented May 12, 2017

OS App model, happen in model/measures folder

@jmarrec
Copy link
Collaborator Author

jmarrec commented Sep 29, 2017

Still relevant as of 2.2.1

@macumber macumber changed the title Delete a measure, readd it from library: no prompt and duplicated folders Delete a measure, re-add it from library: no prompt and duplicated folders Jan 13, 2018
@crossingchen
Copy link

Hi, I'm also having this issue using v2.4.1, Windows 7 Enterprise. After deleting a measure then add back on in openstudio measure tab, in the measure folder it adds a new folder ended with those "1"s.

And if I edit the current measure.rb file (for example debugging my measure in my measure folder), synchronize with library and rerun the program, the previous error still shows in openstudio. After a couple times, I realized it is because all these previous measure files are not updated. But for whatever reason, even if i delete the measure folder, it still creates all these previous measure files ("1" ~ "1 1 1 1 1 1") when I hit run and all those previous measure files are the "old" version.

The only thing I can do to bypass this right now is to copy the osm file only and rename it, start a clean new file without any measures, then apply the updated measure.

Is there any update on this issue? Thanks.

@jmarrec
Copy link
Collaborator Author

jmarrec commented Jul 13, 2018

Just reproduced this with current develop (9edf6e6a7845053047b4dfc82113e08cade23fc9, 2.6.0 basically) on Ubuntu 16.04

@jmarrec
Copy link
Collaborator Author

jmarrec commented Sep 3, 2018

Check out WorkflowController.cpp#L224.

The problem is that we don't want to delete the directory from disk until the user actually saves...

@jmarrec
Copy link
Collaborator Author

jmarrec commented May 31, 2021

Updating with permalink to this repo:

void MeasureStepController::removeItemForStep(MeasureStep step) {
std::vector<MeasureStep> oldMeasureSteps = measureSteps();
bool didRemove = false;
std::vector<MeasureStep> newMeasureSteps;
newMeasureSteps.reserve(oldMeasureSteps.size());
for (const auto& oldMeasureStep : oldMeasureSteps) {
if (oldMeasureStep == step) {
didRemove = true;
} else {
newMeasureSteps.push_back(oldMeasureStep);
}
}
if (didRemove) {
// DLM: TODO actually remove the directory here, make sure it not being used by any other steps first
// maybe want a purge unused measures in WorkflowJSON?
// set the new steps
m_app->currentModel()->workflowJSON().setMeasureSteps(m_measureType, newMeasureSteps);
emit modelReset();
}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants