Skip to content

Commit

Permalink
worked through some todos
Browse files Browse the repository at this point in the history
  • Loading branch information
lmoertl committed Sep 3, 2024
1 parent a13174e commit 3be4fdc
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 36 deletions.
40 changes: 18 additions & 22 deletions src/components/DataDisplay/DataDisplayKeywordInContext.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const { queries } = storeToRefs(queryStore);
const api = useApiClient();
const showViewOptionsMode = ref(false);
const KWICresults: Ref<Array<Array<never>>> = ref([]);
const KWICresults: Ref<Array<Array<KeywordInContext>>> = ref([]);
const KWICresultsLoading: Ref<Array<boolean>> = ref([]);
const q = computed(() =>
Expand Down Expand Up @@ -44,27 +44,23 @@ const q = computed(() =>
return response.data;
},
select: (data: Type06Concordance) => {
//@ts-expect-error TODO properly type this
KWICresults.value[index] =
data.Lines?.map(({ Tbl_refs, Left, Kwic, toknum, Right }) => {
// this mapping is directly taken from the ancient code
return {
refs: Tbl_refs,
date: Tbl_refs![1] ?? "",
source: Tbl_refs![4] ?? "",
region: Tbl_refs![2] ?? "",
left: Left!
// @ts-expect-error TODO properly type this
.map(({ str, strc }: { str: string; strc: string }) => str || strc)
.join(" "),
word: typeof Kwic![0] !== "undefined" ? Kwic![0].str : "",
// @ts-expect-error TODO properly type this
right: Right!.map(({ str }: { str: string }) => str).join(" "),
docid: Tbl_refs![0] ?? "",
topic: Tbl_refs![3] ?? "",
toknum,
};
}) ?? [];
KWICresults.value[index] = (data.Lines?.map(({ Tbl_refs, Left, Kwic, toknum, Right }) => {
// this mapping is directly taken from the ancient code
return {
refs: Tbl_refs,
date: Tbl_refs![1] ?? "",
source: Tbl_refs![4] ?? "",
region: Tbl_refs![2] ?? "",
// @ts-ignore wrong types in api lib
left: Left!.map(({ str, strc }) => str || strc).join(" "),
word: typeof Kwic![0] !== "undefined" ? Kwic![0].str : "",
// @ts-ignore wrong types in api lib
right: Right!.map(({ str }: { str: string }) => str).join(" "),
docid: Tbl_refs![0] ?? "",
topic: Tbl_refs![3] ?? "",
toknum,
};
}) ?? []) as unknown as Array<KeywordInContext>;
KWICresultsLoading.value[index] = false;
},
};
Expand Down
10 changes: 5 additions & 5 deletions src/components/DataDisplay/DataDisplayWordFormFrequencies.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ const { queries } = storeToRefs(queryStore);
const api = useApiClient();
const wordFormFrequencies: Ref<Array<Array<never>>> = ref([]);
const wordFormFrequencies: Ref<Array<Array<{ word: string; absolute: number; relative: number }>>> =
ref([]);
const wordFormFrequenciesLoading: Ref<Array<boolean>> = ref([]);
const q = computed(() =>
Expand All @@ -34,15 +35,14 @@ const q = computed(() =>
return response.data;
},
select: (data: Type11Freqml) => {
//@ts-expect-error TODO properly type this
wordFormFrequencies.value[index] =
data.Blocks?.map(
(block) =>
block.Items?.map((item) => {
return {
word: item.Word![0]!.n,
absolute: item.frq,
relative: item.fpm,
word: item.Word![0]!.n!,
absolute: item.frq!,
relative: item.fpm!,
};
}) ?? [],
)[0] ?? [];
Expand Down
8 changes: 0 additions & 8 deletions src/components/Facetting/FacettingModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,6 @@ const api = useApiClient();
const t = useTranslations("Corpsum");
// todo fetch the corpus results
// const corpusStore = useCorporaStore();
// const { corpInfoResponse } = storeToRefs(corpusStore);
// const { data } = await api.search.getTextTypesWithNorms({
// corpname: props.query.corpus,
// });
const { data } = useQuery({
queryKey: ["get-texttypes-with-norms", props.query.corpus] as const,
queryFn: async () => {
Expand Down
2 changes: 1 addition & 1 deletion src/types/query.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ interface CorpusQuery {
subCorpus: string;
concordance_query: ConcordanceQuery;
KWICAttrsStructs: KWICAttrsStructs;
KWICAttrsStructsOptions: KWICAttrsStructs; // ToDo: this will be refactored to come from a query. -> will eb deleted
KWICAttrsStructsOptions: KWICAttrsStructs; // ToDo: this might be refactored to come via requesat whenever needed.
facettingValues: FacettingValues;
loading: {
yearlyFrequencies: boolean;
Expand Down

0 comments on commit 3be4fdc

Please sign in to comment.