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

[FIX] Select Rows: Fix incorrectly stored values in settings #4798

Merged
merged 1 commit into from
May 22, 2020

Conversation

janezd
Copy link
Contributor

@janezd janezd commented May 21, 2020

Issue

Select Rows stored values of discrete variables as indices. If the data changed so that values were reordered, it chose wrong values. If values were removed, it could crash with index out of range.

To reproduce, construct File -> Select Rows -> Select Rows. Load Iris, obviously.

  • In the second Select Rows, choose the second Iris type.
  • In the first Select Rows remove the first type and remove unused classes.

After this the second Select Rows will have selected the (originaly) third (now second) Iris type.

Alternatively:

  • In the second Select Rows select the last Iris type
  • In the first Select Rows remove one type and remove unused classes.

This will crash the second Select Rows widget.

Description of changes
  • Use DomainModel for combos.
  • Internally store variables as instances of Variable; context handler converts this to the usual str, int presentation. With this, the context handler has an instance of variable, which it needs to see the values.
  • Context handler stores values as strings. Conversion from and to int is done in context handler to minimize the changes to the widget's code.
Includes
  • Code changes
  • Tests

@codecov
Copy link

codecov bot commented May 21, 2020

Codecov Report

Merging #4798 into master will increase coverage by 0.08%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master    #4798      +/-   ##
==========================================
+ Coverage   83.86%   83.95%   +0.08%     
==========================================
  Files         281      276       -5     
  Lines       56804    55990     -814     
==========================================
- Hits        47638    47005     -633     
+ Misses       9166     8985     -181     

@janezd janezd force-pushed the selectrows-fix-values-in-contexts branch from 783013c to 1a0a1e6 Compare May 21, 2020 14:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants