BSData / BSData/ronin

PSA: Constraints with "roster" scope on shared items - the "shared?" checkbox

Open
#1 1 comment 0 reactions 1 assignee Claimed by @Ayaxsfs View on GitHub
Dominant language
Gosu
Stars
1
Forks
0
PR merge metrics
No merged PRs in 30d

Description

Constraint, condition and repeat elements (queries) on shared elements have a mysterious "shared?" checkbox.

**Short Answer:** Check the "shared" box for _big_ performance improvements! Version 2.00.05 checks the "shared" box by default.

**Why?**

If this checkbox is checked, the query works in a global way - like it did in 1.15.x. This means that _all_ selections of the _shared_ entry are counted towards the query, no matter the parent - i.e. all links to the entry count.

If left unchecked, the query works on a _per entry_ basis, like a normal entry. This means only selections of _this instance_ of the entry are counted towards the query, and the parent matters - i.e. only links to this entry on a particular parent entry count.

Consider:

```
|- Shared Selection Entries
|- S
|- Constraint: Max 1 in Roster

|- Selection Entries
|- A
|- Link to S
|- B
|- Link to S
```

1) The user selects one of both A and B in their roster, and selects S for both of them.

- If the constraint has "shared" checked, this will give an error. The constraint is "max 1 S in roster". The user has selected two of S, which violates the constraint.

- If the constraint does _not_ have "shared" checked, no error will be given. The constraints are "max 1 A->S in roster" and "max 1 B->S in roster". The user has selected one of A->S and one of B->S, which does not violate the constraint.

2) The user selects two of A in their roster and selects S for both of them.

- If the constraint has "shared" checked, this will give an error, like before. The constraint is "max 1 S in roster". The user has selected two of S, which violates the constraint.

- If the constraint does _not_ have "shared" checked, _an error will still be given_. The constraints are "max 1 A->S in roster" and "max 1 B->S in roster". The user has selected two of A->S, which violates the constraint.

---

This gives greater power over how you want a query to work. But great power = great responsibility blah blah.

Leaving the "shared" box unchecked means that the app must check the condition multiple times (for each parent) when validating for error messages. Each linked copy of the shared item must be checked.

Checking the "shared" box is much _much_ faster, as the app only needs to check once, globally, that the condition is met/broken.

So check the box unless you have a good reason not to.

Version 2.00.05 (desktop) now checks this box by default.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.