BSData / BSData/dust1947

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

Open
#2 0 comments 0 reactions 0 assignees 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

Research direction

Read the issue text first; it explains the "shared" checkbox behavior and recommends enabling it by default in version 2.00.05. No files, tests, or specific documentation location are named, so confirm where this guidance belongs before making any change. Done means the relevant documentation clearly preserves these usage and performance details.

Written by the indexing model from the issue text.

Assessment

Domain
documentation
Issue type
Documentation
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.