diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2025-04-08 18:19:39 -0300 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2025-04-10 16:02:42 -0300 |
commit | 670d442f1840586085094c9d59d354f8e3b54549 (patch) | |
tree | f6382f7140f68249637a2559e7f765f6f9247103 /src/data/composite/things/contribution/thingPropertyMatches.js | |
parent | c72196f5feae56ff734b00189908ad362a13ea47 (diff) |
data: Contribution: check prop on artwork when self-classifying
Diffstat (limited to 'src/data/composite/things/contribution/thingPropertyMatches.js')
-rw-r--r-- | src/data/composite/things/contribution/thingPropertyMatches.js | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/src/data/composite/things/contribution/thingPropertyMatches.js b/src/data/composite/things/contribution/thingPropertyMatches.js index 4a37f2cf..1e9019b8 100644 --- a/src/data/composite/things/contribution/thingPropertyMatches.js +++ b/src/data/composite/things/contribution/thingPropertyMatches.js @@ -1,6 +1,7 @@ import {input, templateCompositeFrom} from '#composite'; import {exitWithoutDependency} from '#composite/control-flow'; +import {withPropertyFromObject} from '#composite/data'; export default templateCompositeFrom({ annotation: `thingPropertyMatches`, @@ -12,19 +13,31 @@ export default templateCompositeFrom({ }, steps: () => [ + { + dependencies: ['thing', 'thingProperty'], + + compute: (continuation, {thing, thingProperty}) => + continuation({ + ['#thingProperty']: + (thing.constructor[Symbol.for('Thing.referenceType')] === 'artwork' + ? thing.artistContribsFromThingProperty + : thingProperty), + }), + }, + exitWithoutDependency({ - dependency: 'thingProperty', + dependency: '#thingProperty', value: input.value(false), }), { dependencies: [ - 'thingProperty', + '#thingProperty', input('value'), ], compute: ({ - ['thingProperty']: thingProperty, + ['#thingProperty']: thingProperty, [input('value')]: value, }) => thingProperty === value, |