Skip to content

Commit c946c41

Browse files
MaxNumeriquegithub-actions[bot]
authored andcommitted
Apply prepare changes
1 parent a27d2f2 commit c946c41

File tree

2 files changed

+20
-10
lines changed

2 files changed

+20
-10
lines changed

components/ObjectSelector.vue

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,13 @@
7272
const responses = await Promise.all(
7373
filenames.map((filename) =>
7474
api_fetch({ schema, params: { filename, supported_feature } }),
75-
)
75+
),
7676
)
7777
const values = responses.map((r) => r.data.value.allowed_objects)
7878
const allKeys = [...new Set(values.flatMap((v) => Object.keys(v)))]
7979
const commonKeys = allKeys.filter(
80-
(key) => !values.some((obj) => !Object.prototype.hasOwnProperty.call(obj, key)),
80+
(key) =>
81+
!values.some((obj) => !Object.prototype.hasOwnProperty.call(obj, key)),
8182
)
8283
const finalObject = {}
8384
for (const key of commonKeys) {
@@ -95,25 +96,28 @@
9596
const objectKeys = Object.keys(finalObject)
9697
if (objectKeys.length) {
9798
const highestLoadScore = Math.max(
98-
...objectKeys.map((key) => finalObject[key].is_loadable)
99+
...objectKeys.map((key) => finalObject[key].is_loadable),
99100
)
100101
if (highestLoadScore > 0) {
101102
const bestScoreObjects = objectKeys.filter(
102-
(key) => finalObject[key].is_loadable === highestLoadScore
103+
(key) => finalObject[key].is_loadable === highestLoadScore,
103104
)
104105
if (bestScoreObjects.length === 1) {
105106
set_geode_object(bestScoreObjects[0])
106107
alreadySelected = true
107108
} else {
108109
const highestPriority = Math.max(
109110
...bestScoreObjects.map(
110-
(key) => finalObject[key].object_priority ?? -Infinity
111-
)
111+
(key) => finalObject[key].object_priority ?? -Infinity,
112+
),
112113
)
113114
const bestPriorityObjects = bestScoreObjects.filter(
114-
(key) => finalObject[key].object_priority === highestPriority
115+
(key) => finalObject[key].object_priority === highestPriority,
115116
)
116-
if (highestPriority !== -Infinity && bestPriorityObjects.length === 1) {
117+
if (
118+
highestPriority !== -Infinity &&
119+
bestPriorityObjects.length === 1
120+
) {
117121
set_geode_object(bestPriorityObjects[0])
118122
alreadySelected = true
119123
}

test/components/ObjectSelector.nuxt.test.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,14 @@ describe("ObjectSelector.vue", async () => {
8888
var response = { allowed_objects: {} }
8989
const geode_object_1 = "BRep"
9090
const geode_object_2 = "EdgedCurve3D"
91-
response["allowed_objects"][geode_object_1] = { is_loadable: 1.0, object_priority: 2 }
92-
response["allowed_objects"][geode_object_2] = { is_loadable: 1.0, object_priority: 1 }
91+
response["allowed_objects"][geode_object_1] = {
92+
is_loadable: 1.0,
93+
object_priority: 2,
94+
}
95+
response["allowed_objects"][geode_object_2] = {
96+
is_loadable: 1.0,
97+
object_priority: 1,
98+
}
9399
registerEndpoint(allowed_objects.$id, {
94100
method: allowed_objects.methods[0],
95101
handler: () => response,

0 commit comments

Comments
 (0)