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

Smartblock javascript merges criteria of different groups into a single or block when items are deleted #732

Open
Robbt opened this issue Feb 9, 2019 · 1 comment

Comments

2 participants
@Robbt
Copy link
Member

commented Feb 9, 2019

Describe the bug
Basically there is a bug in the jquery code that only became noticeable once we modified the code in #704 to make it work like the UI presented it. The notion of adding modifiers was previously expected to be only used once per criteria but the UI allowed people to add a item with the same criteria linked by an AND statement.

The issue is now that the jquery code merges everything into a single OR loop whenever an item is deleted is here -

/* assign next row to current row for all rows below and including
* the row getting removed
*/
for (var i=0; i<count; i++) {
index = getRowIndex(curr);
var criteria = next.find('[name^="sp_criteria_field"]').val();
curr.find('[name^="sp_criteria_field"]').val(criteria);
var modifier = next.find('[name^="sp_criteria_modifier"]').val();
populateModifierSelect(curr.find('[name^="sp_criteria_field"]'), false);
curr.find('[name^="sp_criteria_modifier"]').val(modifier);
var criteria_value = next.find('[name^="sp_criteria_value"]').val();
curr.find('[name^="sp_criteria_value"]').val(criteria_value);

To Reproduce
Steps to reproduce the behavior:

  1. Create a smartblock with Genre matches X
    2.Click Add Criteria
  2. Make it Genre Matches Y
  3. Add modifer for Genre Matches Z under Matches Y
  4. Delete matches Y
  5. Matches Z will be merged under Matches X or Z vs. remaining a separate matches X and matches Z.

Expected behavior
When a modifer is deleted it should not rearrange and merge the items above it under the same criteria if they were originally separate.

LibreTime version:
Current master

Additional context
Refactoring the jquery code would probably be required to fix this since it is kind of funky how this is all programmed so this is probably a low priority. It might even make sense to use this as an opportunity to rewrite and replace the code with a modern javascript engine.

@frecuencialibre

This comment has been minimized.

Copy link
Contributor

commented Feb 9, 2019

@Robbt Robbt added this to Low priority in Bug Triage Board Apr 23, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.