Skip to content

Commit

Permalink
Optimize build text computation
Browse files Browse the repository at this point in the history
  • Loading branch information
ltouroumov committed Sep 24, 2024
1 parent 733aabe commit aa2acd0
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions components/viewer/utils/ExportCode.vue
Original file line number Diff line number Diff line change
Expand Up @@ -129,21 +129,21 @@ const exportText = computed<string>(() => {
return R.pipe(
R.map(({ packRow, choices }: PackRow): string => {
const choiceTitles = R.map(({ obj, count }) => {
let result = obj.title;
if (count > 1 || obj.isSelectableMultiple) {
result += ` x ${count}`;
}
if (R.isNotEmpty(obj.addons) && exportAddons.value) {
const activeAddons = R.filter((addon) => {
const condition = buildConditions(addon);
return condition(selectedIds.value);
}, obj.addons);
if (R.isNotEmpty(activeAddons)) {
const addonTitles = R.map((addon) => addon.title, activeAddons);
if (count > 1 || obj.isSelectableMultiple)
return `${obj.title} x ${count} ( ${R.join(' , ', addonTitles)} )`;
else return `${obj.title} ( ${R.join(' , ', addonTitles)} )`;
result += ` (${R.join(' , ', addonTitles)})`;
}
}
if (count > 1 || obj.isSelectableMultiple)
return `${obj.title} x ${count}`;
else return obj.title;
return result;
}, choices);
if (exportTextHeaders.value) {
return R.concat(`**${packRow.title}**\n`, R.join(', ', choiceTitles));
Expand Down

0 comments on commit aa2acd0

Please sign in to comment.