Skip to content

Commit

Permalink
Merge pull request #5982 from mzimandl/fixes
Browse files Browse the repository at this point in the history
Fix listing documents query
  • Loading branch information
tomachalek authored Jul 28, 2023
2 parents 71fd3db + c3f7d95 commit 1ade08c
Showing 1 changed file with 52 additions and 49 deletions.
101 changes: 52 additions & 49 deletions public/files/js/plugins/liveAttributes/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -618,56 +618,59 @@ export class LiveAttrsModel extends StatelessModel<LiveAttrsModelState> implemen
laligned:Array<string>;
lattrs:{[k:string]:Array<string>};
} {
return pipe(
state.selectionSteps,
List.foldl<
TTSelectionStep|AlignedLangSelectionStep,
{
corpname:string,
laligned:Array<string>,
lattrs: {[k:string]:Array<string>}
}
>(
(acc, v) => {
if (isAlignedSelectionStep(v)) {
acc.laligned = v.attributes;
return acc;

} else {
acc.lattrs = Dict.mergeDict(
(o, n) => n,
Dict.map(
(v, k) => {
if (v.type === 'encoded') {
return [v.decodedValue];
}
return v.selections;
},
v.values
),
acc.lattrs,
);
return acc;
let initData = {
corpname: state.firstCorpus,
laligned: pipe(
state.initialAlignedCorpora,
List.filter(v => v.selected),
List.map(v => v.value),
),
lattrs: pipe(
state.subcorpDefinition,
Dict.map((selections, k) => {
if (Array.isArray(selections))
return selections
return [TextTypes.isExportedRegexpSelection(selections) ? selections.regexp : selections]
})
),
};
return state.selectionSteps.length == 0 ?
initData :
pipe(
state.selectionSteps,
List.foldl<
TTSelectionStep|AlignedLangSelectionStep,
{
corpname:string,
laligned:Array<string>,
lattrs: {[k:string]:Array<string>}
}
},
{
corpname: state.firstCorpus,
laligned: pipe(
state.initialAlignedCorpora,
List.filter(v => v.selected),
List.map(v => v.value),
),
lattrs: pipe(
state.subcorpDefinition,
Dict.map((selections, k) => {
if (Array.isArray(selections))
return selections
return [TextTypes.isExportedRegexpSelection(selections) ? selections.regexp : selections]
})
),
}
)
);
>(
(acc, v) => {
if (isAlignedSelectionStep(v)) {
acc.laligned = acc.laligned.concat(v.attributes);
return acc;

} else {
acc.lattrs = Dict.mergeDict(
(o, n) => n,
Dict.map(
(v, k) => {
if (v.type === 'encoded') {
return [v.decodedValue];
}
return v.selections;
},
v.values
),
acc.lattrs,
);
return acc;
}
},
initData
)
);
}

private reloadSizes(state:LiveAttrsModelState, dispatch:SEDispatcher):void {
Expand Down

0 comments on commit 1ade08c

Please sign in to comment.