diff --git a/web/app/corpora/events.py b/web/app/corpora/events.py index 3a36e9d3..7357d817 100644 --- a/web/app/corpora/events.py +++ b/web/app/corpora/events.py @@ -177,7 +177,6 @@ def corpus_analysis_get_match_with_full_context(payload): i = 0 # Send data one match at a time. for index, f_cpos, l_cpos in zip(data_indexes, first_cpos, last_cpos): - logger.warning(index) i += 1 tmp_match = s.export(f_cpos, l_cpos, context=10) payload['matches'].append(tmp_match['matches'][0]) diff --git a/web/app/static/js/modules/corpus_analysis/client/Client.js b/web/app/static/js/modules/corpus_analysis/client/Client.js index b5b1bfdf..2d94121f 100644 --- a/web/app/static/js/modules/corpus_analysis/client/Client.js +++ b/web/app/static/js/modules/corpus_analysis/client/Client.js @@ -200,6 +200,12 @@ class Client { results[objectKey].match_count = matches.length; results[objectKey].cpos_ranges = results.data.cpos_ranges; results[objectKey].fullContext = false; + if (objectKey === 'subResultsData') { + // Remove match_count from texts, because they are useless in sub results + for (let [key, value] of Object.entries(results[objectKey].text_lookup)) { + delete results[objectKey].text_lookup[key].match_count; + } + } console.info('Results data without context has been saved.', results); this.isBusy = false; this.notifyView('results-data-recieved', {type: resultsType, diff --git a/web/app/static/js/modules/corpus_analysis/client/callbacks.js b/web/app/static/js/modules/corpus_analysis/client/callbacks.js index 34299505..74207478 100644 --- a/web/app/static/js/modules/corpus_analysis/client/callbacks.js +++ b/web/app/static/js/modules/corpus_analysis/client/callbacks.js @@ -111,8 +111,8 @@ function saveResultsData() { } // Save incoming data. Data is incoming one match at a time. results[objectKey].matches.push(...payload.matches); - results[objectKey].addData(payload.cpos_lookup, "cpos_lookup"); - results[objectKey].addData(payload.text_lookup, "text_lookup"); + results[objectKey].addData(payload.cpos_lookup, 'cpos_lookup'); + results[objectKey].addData(payload.text_lookup, 'text_lookup'); results[objectKey].addData(results.metaData); results[objectKey].query = results.data.query; results[objectKey].corpus_type = type; @@ -125,6 +125,10 @@ function saveResultsData() { progress: payload.progress}) client.isBusy = false; if (payload.progress === 100) { + if (objectKey === 'fullResultsData') { + // Get match count per text from results.data only for fullResultsData + results[objectKey].text_lookup = results.data.text_lookup; + } client.notifyView('results-data-recieved', {type: type, results: results, fullContext: true}); diff --git a/web/app/static/js/modules/corpus_analysis/view/eventListeners.js b/web/app/static/js/modules/corpus_analysis/view/eventListeners.js index 9215bae3..1685c47c 100644 --- a/web/app/static/js/modules/corpus_analysis/view/eventListeners.js +++ b/web/app/static/js/modules/corpus_analysis/view/eventListeners.js @@ -138,8 +138,8 @@ function createFullResults(resultsList, results) { function createSubResults(resultsList, results) { resultsList.subResultsCreate.onclick = (event) => { let dataIndexes = []; - resultsList.addToSubResultsIdsToShow.forEach((id) => { - dataIndexes.push(id - 1); + Object.keys(resultsList.subResultsIndexes).forEach((id) => { + dataIndexes.push(id); }); resultsList.subResultsCreate.querySelector('i').classList.toggle('hide'); resultsList.subResultsCreate.innerText = 'Creating...'; diff --git a/web/app/static/js/web-components/InfoMenu.js b/web/app/static/js/web-components/InfoMenu.js deleted file mode 100644 index af6f8599..00000000 --- a/web/app/static/js/web-components/InfoMenu.js +++ /dev/null @@ -1,83 +0,0 @@ -/** - * HTML for showing infos about the current query or result. Also gives - * the user the abiltiy to access the meta data for the current query or - * result. - */ -const template = document.createElement('template'); -template.innerHTML = ` - - - - - -
-
Infos
-
-
-
- -
-
-

- - 0 - of - (to be determined) - matches loaded. -
- Matches occured in - (to be determined) - corpus files: -
- (to be determined) -

-

- help - The Server is still sending your results. - Functions like "Export Results" and "Match Inspect" will be - available after all matches have been loaded. -

-
-
-
-
-
-
-`; - -class InfoMenu extends HTMLElement { - constructor() { - super(); - - this.appendChild(template.content.cloneNode(true)); - this.attachShadow({ mode: 'open' }); - this.shadowRoot.appendChild(template.content.cloneNode(true)); - - } - - // methods that will be used in connectedCallback on eventListeners - showMetadata() { - console.log('Show metadata somehow'); - } - - connectedCallback() { - const showMetadataBtn = this.querySelector('#show-metadata'); - showMetadataBtn.addEventListener('click', () => this.showMetadata()); - } - - disconnectedCallback() { - const showMetadataBtn = this.querySelector('#show-metadata'); - showMetadataBtn.removeEventListener(); - } -} - -window.customElements.define('info-menu', InfoMenu); - -export { InfoMenu }; \ No newline at end of file