USFS-PNW / Fia-Biosum-Manager

User interface and main code repository for Biosum
http://biosum.info/
Other
3 stars 3 forks source link

OPTIMIZER: description field in optimizer calculated variable did not like use of a quote #353

Open lbross opened 1 week ago

lbross commented 1 week ago

From @jsfried: I used an apostrophe in my description of a calculated variable and got an error message in calculating that made me think that punctuation is a no-no. It seemed to complete normally after the error though, but did not display the new variable in the list of calculated variables. I went to remake it (and avoided punctuation) and it thew a dialog (OK the only choice) telling me that it was overriding existing calcs. So it must have been there but not visible. A little odd.

lbross commented 1 week ago

There are ways to get around this, but don't know that it's worth the effort to accommodate special characters in calculated variable names. Are you okay just supporting letters, numbers, and underscores? If so, we can add a filter to the textbox like we do with the additional harvest cost names.

Edit: Oops read this too quickly. It's in the description. We can look into escaping single quotes in a text string before saving it to the database. We will also need to make sure it looks right when it is displayed afterwards.

The process of creating the variable encompasses 3 tables. It's possible that the entry was made in one table but not all of them.

jsfried commented 1 week ago

We can tell people not to use apostraphes or quotes but it does feel a bit like a straightjacket ;-)

lbross commented 1 week ago

There is a method in the SQLite data manager called FixString() that is intended to handle these cases. Hopefully this gives a good example on how we can fix this. Please check both the economic and fvs variable descriptions.

druepdx commented 1 week ago

Calculated variable descriptions should now allow apostrophes for FVS and ECON variables. It doesn't look like double quotations was ever an issue. I tested adding variable and recalculating them, and I just pushed my code changes