query sui commenti draft
This commit is contained in:
parent
09da5ec2a3
commit
0b4674f875
|
@ -3,7 +3,7 @@
|
||||||
*/
|
*/
|
||||||
import { getJsonQuery, emptyStructCard } from './script_5.0.mod.js';
|
import { getJsonQuery, emptyStructCard } from './script_5.0.mod.js';
|
||||||
import {resetGraphStr} from './syntgraph_5.0.js'
|
import {resetGraphStr} from './syntgraph_5.0.js'
|
||||||
import { getVersiConCitazioni } from './dataMgr.js';
|
import { getVersiConCitazioni, queryRiferimenti} from './dataMgr.js';
|
||||||
|
|
||||||
export var resetResult;
|
export var resetResult;
|
||||||
export var lsentid;
|
export var lsentid;
|
||||||
|
@ -43,10 +43,10 @@ $(document).ready(function() {
|
||||||
var listarisultati = [];
|
var listarisultati = [];
|
||||||
listaPeriodiRisultato = [];
|
listaPeriodiRisultato = [];
|
||||||
listaClausoleRisultato = []
|
listaClausoleRisultato = []
|
||||||
var commentsArray = []
|
/*var commentsArray = []
|
||||||
var commentsJson = {}
|
var commentsJson = {}*/
|
||||||
var commentsSQL = {}
|
var commentsSQL = {}
|
||||||
var resultSentences = new Set()
|
/*var resultSentences = new Set()*/
|
||||||
const cantiche = ["Inferno", "Purgatorio", "Paradiso"]
|
const cantiche = ["Inferno", "Purgatorio", "Paradiso"]
|
||||||
var loadedCanti = new Set();
|
var loadedCanti = new Set();
|
||||||
const openSTag = "{"
|
const openSTag = "{"
|
||||||
|
@ -59,10 +59,6 @@ $(document).ready(function() {
|
||||||
var showOffset = 30;
|
var showOffset = 30;
|
||||||
var idCitazione = "citazioneFrase";
|
var idCitazione = "citazioneFrase";
|
||||||
|
|
||||||
// console.log(getAutoriFontiCitazioni())
|
|
||||||
// console.log(getCommentatori())
|
|
||||||
|
|
||||||
var initial=true;
|
|
||||||
initCitazioni();
|
initCitazioni();
|
||||||
|
|
||||||
resetResult = function() {
|
resetResult = function() {
|
||||||
|
@ -270,9 +266,6 @@ $(document).ready(function() {
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Costruzione e visualizzazione del risultato in frasi.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Costruzione e visualizzazione del risultato in frasi.
|
* Costruzione e visualizzazione del risultato in frasi.
|
||||||
|
@ -898,13 +891,14 @@ $(document).ready(function() {
|
||||||
}
|
}
|
||||||
var canto = mcanto.split('_')[1]
|
var canto = mcanto.split('_')[1]
|
||||||
var idCommento = "Commento_" + idcantica + "_" + canto + "_";
|
var idCommento = "Commento_" + idcantica + "_" + canto + "_";
|
||||||
var myid=cantica+'_Canto_'+canto+'_'
|
var idverso=cantica+'_Canto_'+canto+'_'
|
||||||
var minimapid=cantica+'Canto_'+canto
|
var idminimap=cantica+'Canto_'+canto
|
||||||
/*console.log(myid)*/
|
/*console.log(myid)*/
|
||||||
if (canto.length == 1)
|
if (canto.length == 1)
|
||||||
canto = '0' + canto
|
canto = '0' + canto
|
||||||
//commentsJson = getVersiConCitazioniJson(cantica, canto)
|
//commentsJson = getVersiConCitazioniJson(cantica, canto)
|
||||||
var mresult =await getVersiConCitazioni(cantica, canto)
|
var mresult =await getVersiConCitazioni(cantica, canto)
|
||||||
|
|
||||||
commentsSQL= Object.groupBy(mresult, ({ VersoCitazione }) => VersoCitazione);
|
commentsSQL= Object.groupBy(mresult, ({ VersoCitazione }) => VersoCitazione);
|
||||||
|
|
||||||
var tmpkeys=[]
|
var tmpkeys=[]
|
||||||
|
@ -919,12 +913,12 @@ $(document).ready(function() {
|
||||||
var pio=$( "#"+idCommento+t)
|
var pio=$( "#"+idCommento+t)
|
||||||
if(pio.length)
|
if(pio.length)
|
||||||
break;
|
break;
|
||||||
var elverso=$( "#"+myid+t)//$("li[value='"+t+"']")
|
var elverso=$( "#"+idverso+t)//$("li[value='"+t+"']")
|
||||||
console.log(elverso)
|
//console.log(elverso)
|
||||||
createCommentSpan(idCommento+t, elverso, commentsSQL[ke].length)
|
createCommentSpan(idCommento+t, elverso, commentsSQL[ke].length)
|
||||||
}
|
}
|
||||||
|
|
||||||
drawMinimap("#" + minimapid, false)
|
drawMinimap("#" + idminimap, false)
|
||||||
console.log (commentsSQL)
|
console.log (commentsSQL)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1499,7 +1493,7 @@ $(document).ready(function() {
|
||||||
listaPeriodiRisultato = []
|
listaPeriodiRisultato = []
|
||||||
listaClausoleRisultato = []
|
listaClausoleRisultato = []
|
||||||
listaClausoleRisultatoContesti = []
|
listaClausoleRisultatoContesti = []
|
||||||
resultSentences = new Set()
|
//resultSentences = new Set()
|
||||||
if (cantoDisplayed == '#vistaFrasi')
|
if (cantoDisplayed == '#vistaFrasi')
|
||||||
cantoDisplayed = prevCantoDisplayed
|
cantoDisplayed = prevCantoDisplayed
|
||||||
$(cantoDisplayed).attr('style', 'display: d-flex;');
|
$(cantoDisplayed).attr('style', 'display: d-flex;');
|
||||||
|
@ -1531,6 +1525,10 @@ $(document).ready(function() {
|
||||||
unitaRicerca = 'forma'
|
unitaRicerca = 'forma'
|
||||||
else
|
else
|
||||||
unitaRicerca = jsonQuery['unitaRicerca']
|
unitaRicerca = jsonQuery['unitaRicerca']
|
||||||
|
if (unitaRicerca=='riferimenti'){
|
||||||
|
queryRiferimenti(jsonQuery.Riferimento100)
|
||||||
|
return
|
||||||
|
}
|
||||||
console.log("got json query, unita ricerca: " + unitaRicerca)
|
console.log("got json query, unita ricerca: " + unitaRicerca)
|
||||||
if (jsonQuery['QueryAvanzata'] == 0 && jsonQuery['Clausola0']['queryText'] == '') {
|
if (jsonQuery['QueryAvanzata'] == 0 && jsonQuery['Clausola0']['queryText'] == '') {
|
||||||
alert('Digitare una stringa da cercare')
|
alert('Digitare una stringa da cercare')
|
||||||
|
|
|
@ -5,6 +5,7 @@ import * as duckdb from 'https://cdn.jsdelivr.net/npm/@duckdb/duckdb-wasm@1.29.0
|
||||||
var rif_commentatori=[];
|
var rif_commentatori=[];
|
||||||
var rif_autori=[];
|
var rif_autori=[];
|
||||||
var rif_areetematiche=[];
|
var rif_areetematiche=[];
|
||||||
|
var rif_fonti=[];
|
||||||
|
|
||||||
|
|
||||||
const JSDELIVR_BUNDLES = duckdb.getJsDelivrBundles();
|
const JSDELIVR_BUNDLES = duckdb.getJsDelivrBundles();
|
||||||
|
@ -53,6 +54,8 @@ var table=await conn.query(`
|
||||||
const result2 = table.toArray().map((row) => row.toJSON());
|
const result2 = table.toArray().map((row) => row.toJSON());
|
||||||
rif_commentatori=result2.map((x) => x['Com']);
|
rif_commentatori=result2.map((x) => x['Com']);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*rif_commentatori.sort((a, b) => {
|
/*rif_commentatori.sort((a, b) => {
|
||||||
var sre= (a.replace(/^\D+/g, '')-b.replace(/^\D+/g, ''))
|
var sre= (a.replace(/^\D+/g, '')-b.replace(/^\D+/g, ''))
|
||||||
console.log(sre)
|
console.log(sre)
|
||||||
|
@ -67,10 +70,22 @@ var table=await conn.query(`
|
||||||
const result3 = table.toArray().map((row) => row.toJSON());
|
const result3 = table.toArray().map((row) => row.toJSON());
|
||||||
|
|
||||||
rif_areetematiche= result3.map((x) => x['CA']);
|
rif_areetematiche= result3.map((x) => x['CA']);
|
||||||
//console.log(rif_areetematiche)
|
|
||||||
|
|
||||||
|
var table1=await conn.query(`
|
||||||
|
select distinct TiFo from riferimenti;
|
||||||
|
`);
|
||||||
|
const result4 = table1.toArray().map((row) => row.toJSON());
|
||||||
|
rif_fonti=result4.map((x) => x['TiFo']);
|
||||||
|
|
||||||
|
//console.log(rif_fonti)
|
||||||
await conn.close();
|
await conn.close();
|
||||||
|
|
||||||
console.log('done')
|
console.log('done')
|
||||||
|
export function getFontiS() {
|
||||||
|
|
||||||
|
return rif_fonti
|
||||||
|
}
|
||||||
|
|
||||||
export function getAreeTematicheS() {
|
export function getAreeTematicheS() {
|
||||||
|
|
||||||
|
@ -89,7 +104,7 @@ export function getCommentatoriS() {
|
||||||
|
|
||||||
export async function getVersiConCitazioni(canticapar = '', cantopar = '') {
|
export async function getVersiConCitazioni(canticapar = '', cantopar = '') {
|
||||||
|
|
||||||
let citcantiche = ['Inferno', 'Purgatorio', 'Paradiso']
|
//let citcantiche = ['Inferno', 'Purgatorio', 'Paradiso']
|
||||||
if (canticapar == '') {
|
if (canticapar == '') {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -113,3 +128,41 @@ export async function getVersiConCitazioni(canticapar = '', cantopar = '') {
|
||||||
return result4
|
return result4
|
||||||
|
|
||||||
}
|
}
|
||||||
|
export async function queryRiferimenti(filtro){
|
||||||
|
if(filtro==null){
|
||||||
|
return
|
||||||
|
}
|
||||||
|
console.log(filtro)
|
||||||
|
const tconn= await db.connect();
|
||||||
|
var querytl='select Cantica, Canto, Verso from riferimenti'
|
||||||
|
var queryfi=' where '
|
||||||
|
if (filtro.Commentatore!=null && filtro.Commentatore.trim()!='all')
|
||||||
|
queryfi+="Com='"+filtro.Commentatore.trim()+"'"
|
||||||
|
else
|
||||||
|
queryfi+="Com like '%'"
|
||||||
|
if (filtro.Autore_Fonte!=null && filtro.Autore_Fonte.trim()!='all')
|
||||||
|
queryfi+=" and Aut='"+filtro.Autore_Fonte.trim()+"'"
|
||||||
|
|
||||||
|
var rs= await tconn.query(querytl+queryfi)
|
||||||
|
var result4 = rs.toArray().map((row) => row.toJSON());
|
||||||
|
|
||||||
|
await tconn.close();
|
||||||
|
var resxcantica= Object.groupBy(result4, ({ Cantica }) => Cantica);
|
||||||
|
for (var cantica in resxcantica){
|
||||||
|
console.log(resxcantica[cantica].length)
|
||||||
|
var i=1;
|
||||||
|
if (cantica=='Purgatorio')
|
||||||
|
i=2
|
||||||
|
if (cantica=='Paradiso')
|
||||||
|
i=3
|
||||||
|
var spanbadgecantica = $('<span />');
|
||||||
|
spanbadgecantica.attr('class', 'badge badge-warning badge-pill mx-2');
|
||||||
|
spanbadgecantica.append(resxcantica[cantica].length)
|
||||||
|
spanbadgecantica.appendTo($('#cantica' + i + '-badge'))
|
||||||
|
console.log(spanbadgecantica)
|
||||||
|
|
||||||
|
}
|
||||||
|
/*console.log(resxcantica)*/
|
||||||
|
return
|
||||||
|
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue