Difference between revisions of "Widget:DCTList"

From LINKS Community Center
Jump to: navigation, search
Line 207: Line 207:
 
         let test = Array.from(functionsData.values(), entry => entry[FUNC_KEY]).flat();
 
         let test = Array.from(functionsData.values(), entry => entry[FUNC_KEY]).flat();
 
         let qstr = test.join('|?')
 
         let qstr = test.join('|?')
         console.log('Func result', test);
+
         // console.log('Func result', test);
        console.log('q len', qstr.length)
+
 
  
 
         const searchFunctions = [
 
         const searchFunctions = [
Line 264: Line 264:
 
             'Multiple accounts per platform'
 
             'Multiple accounts per platform'
 
         ];
 
         ];
 +
 +
        const dctQuery2 = '[[Category:Disaster Community Technology]]' +
 +
                        '[[Is Archived::No]]' +
 +
                        '|limit=500' +
 +
                        '|?Image' +
 +
                        '|?Data Sources' +
 +
                        '|?' + qstr;
 +
                    console.log('new len', dctQuery2.length)
  
 
         const dctQuery = '[[Category:Disaster Community Technology]]' +
 
         const dctQuery = '[[Category:Disaster Community Technology]]' +
Line 278: Line 286:
 
                         '|?' + interoperabilityFunctions.join('|?') +
 
                         '|?' + interoperabilityFunctions.join('|?') +
 
                         '|?' + metaFunctions.join('|?');
 
                         '|?' + metaFunctions.join('|?');
 +
 +
                        console.log('current len', dctQuery.length)
  
 
         const dctQueryUrl = '/api.php?action=ask&format=json&query=' + encodeURIComponent(dctQuery);
 
         const dctQueryUrl = '/api.php?action=ask&format=json&query=' + encodeURIComponent(dctQuery);
 
         const dctResponse = await fetch(dctQueryUrl).then(response => response.json());
 
         const dctResponse = await fetch(dctQueryUrl).then(response => response.json());
 +
 +
        const dctQueryUrl2 = '/api.php?action=ask&format=json&query=' + encodeURIComponent(dctQuery2);
 +
        const dctResponse2 = await fetch(dctQueryUrl2).then(response => response.json());
 +
 +
        console.log(dctResponse2.query.results)
  
 
         const results = dctResponse.query.results;
 
         const results = dctResponse.query.results;
 +
        console.log('current res')
 
         const dctList = Object.getOwnPropertyNames(results).map(dctKey => {
 
         const dctList = Object.getOwnPropertyNames(results).map(dctKey => {
  

Revision as of 15:13, 30 August 2022

Development verstion of the DCT List.
Not ready for production!