Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
vmonakhov committed Oct 8, 2024
1 parent 8e574c4 commit 3abe9be
Showing 1 changed file with 42 additions and 44 deletions.
86 changes: 42 additions & 44 deletions src/components/CognateAnalysisModal/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2152,58 +2152,56 @@ class CognateAnalysisModal extends React.Component {
computeComplexDistance
} = this.props;

if (this.state.lang_mode === "single" || this.state.lang_mode === "multi") {
const groupField = this.fieldDict[this.state.groupFieldIdStr];

/* Gathering info of perspectives we are to analyze. */
let perspectiveInfoList = [];
const multiList = [];

if (this.state.lang_mode === "multi") {
for (const language of this.state.language_list) {
let p_count = 0;

for (const { perspective, treePathList: [subLanguage,] } of language.perspective_list) {
const p_key = id2str(perspective.id);

if (this.state.perspectiveSelectionMap[p_key]) {
perspectiveInfoList.push([
subLanguage.__typename === "Language" ? subLanguage.id : this.baseLanguageId,
perspective.id,
this.fieldDict[this.state.transcriptionFieldIdStrMap[p_key]].id,
this.fieldDict[this.state.translationFieldIdStrMap[p_key]].id,
this.fieldDict[this.state.lexemeFieldIdStrMap[p_key]].id
]);

p_count++;
}
}
const groupField = this.fieldDict[this.state.groupFieldIdStr];

multiList.push([language.id, p_count]);
}
} else {
perspectiveInfoList = this.perspective_list
/* Gathering info of perspectives we are to analyze. */
let perspectiveInfoList = [];
const multiList = [];

if (this.state.lang_mode === "multi") {
for (const language of this.state.language_list) {
let p_count = 0;

.map(({ perspective, treePathList: [subLanguage,] }, index) => [
subLanguage.__typename === "Language" ? subLanguage.id : this.baseLanguageId,
perspective.id,
this.fieldDict[this.state.transcriptionFieldIdStrList[index]].id,
this.fieldDict[this.state.translationFieldIdStrList[index]].id,
this.fieldDict[this.state.lexemeFieldIdStrList[index]].id
])
for (const { perspective, treePathList: [subLanguage,] } of language.perspective_list) {
const p_key = id2str(perspective.id);

.filter((perspective_info, index) => this.state.perspectiveSelectionList[index]);
if (this.state.perspectiveSelectionMap[p_key]) {
perspectiveInfoList.push([
subLanguage.__typename === "Language" ? subLanguage.id : this.baseLanguageId,
perspective.id,
this.fieldDict[this.state.transcriptionFieldIdStrMap[p_key]].id,
this.fieldDict[this.state.translationFieldIdStrMap[p_key]].id,
this.fieldDict[this.state.lexemeFieldIdStrMap[p_key]].id
]);

p_count++;
}
}

multiList.push([language.id, p_count]);
}
} else if (this.state.lang_mode === "single") {
perspectiveInfoList = this.perspective_list

/* Match translations parameter for suggestions. */
.map(({ perspective, treePathList: [subLanguage,] }, index) => [
subLanguage.__typename === "Language" ? subLanguage.id : this.baseLanguageId,
perspective.id,
this.fieldDict[this.state.transcriptionFieldIdStrList[index]].id,
this.fieldDict[this.state.translationFieldIdStrList[index]].id,
this.fieldDict[this.state.lexemeFieldIdStrList[index]].id
])

const matchTranslationsValue = this.state.matchTranslationsFlag
? this.state.matchTranslationsValue === "first_three"
? 1
: 2
: 0;
.filter((perspective_info, index) => this.state.perspectiveSelectionList[index]);
}

/* Match translations parameter for suggestions. */

const matchTranslationsValue = this.state.matchTranslationsFlag
? this.state.matchTranslationsValue === "first_three"
? 1
: 2
: 0;

/* If we are to perform acoustic analysis, we will try to launch it in the background. */

if (this.props.mode === "acoustic") {
Expand Down

0 comments on commit 3abe9be

Please sign in to comment.