From 4cd9e7b1c602a314f307fd8b83b79509bd1a4a8e Mon Sep 17 00:00:00 2001 From: Ken Irwin Date: Tue, 3 Jun 2025 16:59:25 -0400 Subject: [PATCH 01/23] add isTopForSubject property in LibAppsDataFilter.filterBySubject() --- models/libGuides/LibAppsDataFilter.js | 26 +++++++++++++------ .../libGuides/test/LibAppsDataFilter.test.js | 19 +++++++++++--- 2 files changed, 33 insertions(+), 12 deletions(-) diff --git a/models/libGuides/LibAppsDataFilter.js b/models/libGuides/LibAppsDataFilter.js index c9eaf84..eb2defc 100644 --- a/models/libGuides/LibAppsDataFilter.js +++ b/models/libGuides/LibAppsDataFilter.js @@ -78,19 +78,25 @@ module.exports = class LibAppsDataFilter { }); } - filterBySubject(resourceList, subject, topOnly = false) { + filterBySubject(resourceList, subject, reportTopForSubject = false) { var results = []; resourceList.forEach(function (item) { if (item.subjects !== undefined) { - if (topOnly) { - var temp = item.subjects.filter( + if (reportTopForSubject) { + var isTopForSubject = item.subjects.find( (s) => s.name === subject && s.featured === 1 ); - } else { - var temp = item.subjects.filter((s) => s.name === subject); + item.isTopForSubject = isTopForSubject; + // console.log('testing'); } + var itemMatchingSubject = item.subjects.filter( + (s) => s.name === subject + ); if (item.subjects !== undefined) { - if (temp.length > 0) { + if (itemMatchingSubject.length > 0) { + isTopForSubject = + itemMatchingSubject[0].featured === 1 ? true : false; + item.isTopForSubject = isTopForSubject; results.push(item); } } @@ -108,7 +114,7 @@ module.exports = class LibAppsDataFilter { return matches; } - getBestBySubject(resourceList, subjects, topOnly = false) { + getBestBySubject(resourceList, subjects, reportTopForSubject = false) { // expects resourceList to be an object listing database, librarians, or libguides // expect subjects to be an array of subject areas in order of best fit, e.g.: // subjects = ['English','Languages'] @@ -121,7 +127,11 @@ module.exports = class LibAppsDataFilter { for (var i = 0; i < subjects.length; i++) { if (found === false) { // console.log('checking', subjects[i]) - let response = this.filterBySubject(resourceList, subjects[i], topOnly); + let response = this.filterBySubject( + resourceList, + subjects[i], + reportTopForSubject + ); // console.log(response) if (response.length > 0) { var done = response; diff --git a/models/libGuides/test/LibAppsDataFilter.test.js b/models/libGuides/test/LibAppsDataFilter.test.js index 5a0c60d..8cd5a7d 100644 --- a/models/libGuides/test/LibAppsDataFilter.test.js +++ b/models/libGuides/test/LibAppsDataFilter.test.js @@ -28,18 +28,29 @@ describe('LibAppsDataFilter: databases', () => { describe('LibAppsDataFilter: filterBySubject: Databases', () => { english = obj.filterBySubject(databases, 'English'); // 5 - topEnglish = obj.filterBySubject(databases, 'English', true); // 1 bws = obj.filterBySubject(databases, 'Black World Studies'); // 2 + // re-write these tests for the top/nonTop divide + it('should find five English databases', () => { expect(english.length).toBe(5); }); it('should find two BWS databases', () => { expect(bws.length).toBe(2); }); - it('should fine one top English database', () => { - expect(topEnglish.length).toBe(1); - expect(topEnglish[0].name).toBe('19th Century Index'); + it('should fine one top English database and 4 non-top', () => { + expect(english[0].name).toBe('19th Century Index'); + expect(english[0]).toHaveProperty('isTopForSubject'); + expect(english[0].isTopForSubject).toBe(true); + expect(english[1].isTopForSubject).toBe(false); + expect(english[2].isTopForSubject).toBe(false); + expect(english[3].isTopForSubject).toBe(false); + expect(english[4].isTopForSubject).toBe(false); + }); + it('should find no top BWS databases and two non-top', () => { + expect(bws[0]).toHaveProperty('isTopForSubject'); + expect(bws[0].isTopForSubject).toBe(false); + expect(bws[1].isTopForSubject).toBe(false); }); }); From ed2d60489a5de6899b096f28aaaf797a2375239a Mon Sep 17 00:00:00 2001 From: Ken Irwin Date: Wed, 4 Jun 2025 14:57:14 -0400 Subject: [PATCH 02/23] don't report isTopForSubject if not requested in LibAppsDataFilter.filterBySubject --- models/libGuides/LibAppsDataFilter.js | 23 +++++++++-------- .../libGuides/test/LibAppsDataFilter.test.js | 25 +++++++++++++------ 2 files changed, 31 insertions(+), 17 deletions(-) diff --git a/models/libGuides/LibAppsDataFilter.js b/models/libGuides/LibAppsDataFilter.js index eb2defc..52ea6bd 100644 --- a/models/libGuides/LibAppsDataFilter.js +++ b/models/libGuides/LibAppsDataFilter.js @@ -81,22 +81,25 @@ module.exports = class LibAppsDataFilter { filterBySubject(resourceList, subject, reportTopForSubject = false) { var results = []; resourceList.forEach(function (item) { + // if there are subjects defined for the item, + // find the one that matches the requested subject + // if there are no subjects, skip the item if (item.subjects !== undefined) { - if (reportTopForSubject) { - var isTopForSubject = item.subjects.find( - (s) => s.name === subject && s.featured === 1 - ); - item.isTopForSubject = isTopForSubject; - // console.log('testing'); - } + // determine if item matches the requested subject var itemMatchingSubject = item.subjects.filter( (s) => s.name === subject ); + + // if the item has subjects and matches the requested subject + // add it to the results + // if requested, also check to see if it a featured/top item for that subject if (item.subjects !== undefined) { if (itemMatchingSubject.length > 0) { - isTopForSubject = - itemMatchingSubject[0].featured === 1 ? true : false; - item.isTopForSubject = isTopForSubject; + if (reportTopForSubject) { + let isTopForSubject = + itemMatchingSubject[0].featured === 1 ? true : false; + item.isTopForSubject = isTopForSubject; + } results.push(item); } } diff --git a/models/libGuides/test/LibAppsDataFilter.test.js b/models/libGuides/test/LibAppsDataFilter.test.js index 8cd5a7d..8875ce4 100644 --- a/models/libGuides/test/LibAppsDataFilter.test.js +++ b/models/libGuides/test/LibAppsDataFilter.test.js @@ -27,8 +27,8 @@ describe('LibAppsDataFilter: databases', () => { }); describe('LibAppsDataFilter: filterBySubject: Databases', () => { - english = obj.filterBySubject(databases, 'English'); // 5 - bws = obj.filterBySubject(databases, 'Black World Studies'); // 2 + english = obj.filterBySubject(databases, 'English', true); // 5 + bws = obj.filterBySubject(databases, 'Black World Studies', true); // 2 // re-write these tests for the top/nonTop divide @@ -38,14 +38,18 @@ describe('LibAppsDataFilter: filterBySubject: Databases', () => { it('should find two BWS databases', () => { expect(bws.length).toBe(2); }); - it('should fine one top English database and 4 non-top', () => { + it('should find one top English database and 4 non-top', () => { expect(english[0].name).toBe('19th Century Index'); expect(english[0]).toHaveProperty('isTopForSubject'); expect(english[0].isTopForSubject).toBe(true); - expect(english[1].isTopForSubject).toBe(false); - expect(english[2].isTopForSubject).toBe(false); - expect(english[3].isTopForSubject).toBe(false); - expect(english[4].isTopForSubject).toBe(false); + // expect(english[1]).toHaveProperty('isTopForSubject'); + // expect(english[1].isTopForSubject).toBe(false); + // expect(english[2]).toHaveProperty('isTopForSubject'); + // expect(english[2].isTopForSubject).toBe(false); + // expect(english[3]).toHaveProperty('isTopForSubject'); + // expect(english[3].isTopForSubject).toBe(false); + // expect(english[4]).toHaveProperty('isTopForSubject'); + // expect(english[4].isTopForSubject).toBe(false); }); it('should find no top BWS databases and two non-top', () => { expect(bws[0]).toHaveProperty('isTopForSubject'); @@ -79,6 +83,10 @@ describe('LibAppsDataFilter: filterBySubject: librarians', () => { expect(bizLib.length).toBe(1); expect(bizLib[0].last_name).toBe('Janeway'); }); + it('should not have isTopForSubject property', () => { + expect(bizLib[0]).not.toHaveProperty('isTopForSubject'); + expect(langLib[0]).not.toHaveProperty('isTopForSubject'); + }); }); describe('LibAppsDataFilter: guides', () => { @@ -92,6 +100,9 @@ describe('LibAppsDataFilter: guides', () => { it('should find nine guides', () => { expect(guides.length).toBe(9); }); + it('should not have isTopForSubject property', () => { + expect(guides[0]).not.toHaveProperty('isTopForSubject'); + }); }); describe('LibAppsDataFilter: removeUnpublishedGuides', () => { From d13081e9de10a9e946a5176f9e7ee1d9428f77a2 Mon Sep 17 00:00:00 2001 From: Ken Irwin Date: Wed, 4 Jun 2025 16:09:13 -0400 Subject: [PATCH 03/23] UserLibGuidesData -- don't do it all upon initialization; wait for the Controller to request it; easier to test --- controllers/UserDataController.js | 4 +++- models/userLoginData/UserLibGuidesData.js | 8 ++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/controllers/UserDataController.js b/controllers/UserDataController.js index 6ba4485..a97d164 100644 --- a/controllers/UserDataController.js +++ b/controllers/UserDataController.js @@ -131,10 +131,12 @@ module.exports = class UserDataController { let subjectListWithLiaisons = liaisonList.concat(subjectList); let uniqueSubjectList = _.uniq(subjectListWithLiaisons); - let userLibGuides = new UserLibGuidesData( + let userLibGuidesObject = new UserLibGuidesData( uniqueSubjectList, this.user.favorites ); + userLibGuidesObject.getSubjectFiles(); + let userLibGuides = userLibGuidesObject.subjectData; let finishedUserData = { person: this.userLoginInfo, diff --git a/models/userLoginData/UserLibGuidesData.js b/models/userLoginData/UserLibGuidesData.js index f837f09..f479abc 100644 --- a/models/userLoginData/UserLibGuidesData.js +++ b/models/userLoginData/UserLibGuidesData.js @@ -22,8 +22,8 @@ module.exports = class UserLibGuidesData { this.subjectCachePath = subjectCachePath; this.customPath = customPath; this.subjectData = []; - this.getSubjectFiles(); - return this.subjectData; + // this.getSubjectFiles(); + // return this.subjectData; } getSubjectFiles() { @@ -38,7 +38,7 @@ module.exports = class UserLibGuidesData { this.subjectData.push({ name: subject, resources: fileContents, - kenTest: true, + // kenTest: true, }); }); } @@ -94,7 +94,7 @@ module.exports = class UserLibGuidesData { contents.databases !== undefined ) { contents.databases.forEach((database) => { - database.testString = 'bogusKen'; + // database.testString = 'bogusKen'; database.favorite = this.favorites.favoriteDatabases.includes(database.id) || this.favorites.favoriteDatabases.includes(database.id.toString()); From 080f1aae5b4934c274e292a2dc3b6c5d7f6ca300 Mon Sep 17 00:00:00 2001 From: Ken Irwin Date: Fri, 6 Jun 2025 15:17:18 -0400 Subject: [PATCH 04/23] UserLibGuidesData.test passes but needs reorg --- models/userLoginData/UserLibGuidesData.js | 15 ++ .../test/UserLibGuidesData.test.js | 166 ++++++++++++++++++ 2 files changed, 181 insertions(+) create mode 100644 models/userLoginData/test/UserLibGuidesData.test.js diff --git a/models/userLoginData/UserLibGuidesData.js b/models/userLoginData/UserLibGuidesData.js index f479abc..e0da703 100644 --- a/models/userLoginData/UserLibGuidesData.js +++ b/models/userLoginData/UserLibGuidesData.js @@ -103,4 +103,19 @@ module.exports = class UserLibGuidesData { return contents; } + + separateTopAndFavDatabases(contents) { + const databases = contents.databases; + let aboveFold = databases.filter((db) => db.isTopForSubject || db.favorite); + let belowFold = databases.filter( + (db) => !db.isTopForSubject && !db.favorite + ); + contents.databases = { + aboveFold: aboveFold, + belowFold: belowFold, + isArray: Array.isArray(databases), + length: databases.length, + }; + return contents; + } }; diff --git a/models/userLoginData/test/UserLibGuidesData.test.js b/models/userLoginData/test/UserLibGuidesData.test.js new file mode 100644 index 0000000..95bb87f --- /dev/null +++ b/models/userLoginData/test/UserLibGuidesData.test.js @@ -0,0 +1,166 @@ +const spanish = require('./sample-data/subjectsAfterFavsAdded/Spanish.json'); +const german = require('./sample-data/subjectsAfterFavsAdded/German.json'); + +const UserLibGuidesData = require('../UserLibGuidesData'); + +describe('UserLibGuidesData: separateTopAndFavDatabases', () => { + // it('should test true', () => { + // expect(true).toBe(true); + // }); + + // it('should have a databases object thats an array with a filter function (spanish)', () => { + // expect(Array.isArray(spanish.databases)).toBe(true); + // expect(typeof spanish.databases.filter).toBe('function'); + // }); + + it('should get a response from separateTopAndFavDatabases(spanish)', () => { + const obj = new UserLibGuidesData(); + const result = obj.separateTopAndFavDatabases(spanish); + expect(result).toHaveProperty('databases'); + expect(result.databases).toHaveProperty('aboveFold'); + expect(result.databases).toHaveProperty('belowFold'); + expect(Array.isArray(result.databases.aboveFold)).toBe(true); + expect(Array.isArray(result.databases.belowFold)).toBe(true); + expect(result.databases.aboveFold.length).toBe(5); + expect(result.databases.belowFold.length).toBe(3); + }); + + it('should get 3 above/2 below from separateTopAndFavDatabases(german)', () => { + const obj = new UserLibGuidesData(); + const result = obj.separateTopAndFavDatabases(german); + let expectedAboveFold = [ + 'Film and Television Literature Index with Full Text', + 'MLA International Bibliography', + 'Linguistics & Language Behavior Abstracts', + ]; + let expectedBelowFold = [ + 'German Life and Letters', + 'Oxford Bibliographies Online: Literary and Critical Theory', + ]; + expect(result).toHaveProperty('databases'); + expect(result.databases).toHaveProperty('aboveFold'); + expect(result.databases).toHaveProperty('belowFold'); + expect(Array.isArray(result.databases.aboveFold)).toBe(true); + expect(Array.isArray(result.databases.belowFold)).toBe(true); + expect(result.databases.aboveFold.length).toBe(3); + expect(result.databases.belowFold.length).toBe(2); + expect(expectedAboveFold.includes(result.databases.aboveFold[0].name)).toBe( + true + ); + expect(expectedAboveFold.includes(result.databases.aboveFold[1].name)).toBe( + true + ); + expect(expectedAboveFold.includes(result.databases.aboveFold[2].name)).toBe( + true + ); + expect(expectedBelowFold.includes(result.databases.belowFold[0].name)).toBe( + true + ); + expect(expectedBelowFold.includes(result.databases.belowFold[1].name)).toBe( + true + ); + }); + + // German: + // favs: ['Film and Television Literature Index with Full Text','MLA International Bibliography'] + // top: ['Linguistics & Language Behavior Abstracts','MLA International Bibliography'] + // others: ['German Life and Letters','Oxford Bibliographies Online: Literary and Critical Theory'] + + // it('should have aboveFold and belowFold properties for German', () => { + // const result = obj.separateTopAndFavDatabases(german); + // expect(result).toHaveProperty('databases.aboveFold'); + // expect(result).toHaveProperty('databases.belowFold'); + // }); + // it('should find 3 databases aboveFold in German, 2 belowFold', () => { + // const result = obj.separateTopAndFavDatabases(german); + // let expectedAboveFold = [ + // 'Linguistics & Language Behavior Abstracts', + // 'MLA International Bibliography', + // 'Linguistics & Language Behavior Abstracts', + // ]; + // let expectedBelowFold = [ + // 'German Life and Letters', + // 'Oxford Bibliographies Online: Literary and Critical Theory', + // ]; + // expect(result.databases.aboveFold.length).toBe(3); + // expect(result.databases.belowFold.length).toBe(2); + // expect(expectedAboveFold.includes(result.databases.aboveFold[0].name)).toBe( + // true + // ); + // expect(expectedAboveFold.includes(result.databases.aboveFold[1].name)).toBe( + // true + // ); + // expect(expectedAboveFold.includes(result.databases.aboveFold[2].name)).toBe( + // true + // ); + // expect(expectedBelowFold.includes(result.databases.belowFold[0].name)).toBe( + // true + // ); + // expect(expectedBelowFold.includes(result.databases.belowFold[1].name)).toBe( + // true + // ); + // }); + + // // Spanish: + // // favs: ["Clase and Periodica","Fuente Academica"] + // // top: [ + // // "Film and Television Literature Index with Full Text", + // // "Linguistics & Language Behavior Abstracts" + // // "MLA International Bibliography" + // // ] + // // others: ['Ethnic NewsWatch','Latin American Women Writers','Latino Literature'] + + // it('should have a databases object thats an array', () => { + // expect(Array.isArray(spanish.databases)).toBe(true); + // }); + // it('should have a filter function on th databases array', () => { + // expect(typeof spanish.databases.filter).toBe('function'); + // }); + // it('should have aboveFold and belowFold properties for Spanish', () => { + // const result = obj.separateTopAndFavDatabases(spanish); + // expect(result).toHaveProperty('databases.aboveFold'); + // expect(result).toHaveProperty('databases.belowFold'); + // }); + + // it('should find 5 databases aboveFold in Spanish, 3 belowFold', () => { + // const result = obj.separateTopAndFavDatabases(spanish); + // let expectedAboveFold = [ + // 'Clase and Periodica', + // 'Film and Television Literature Index with Full Text', + // 'Fuente Academica', + // 'Linguistics & Language Behavior Abstracts', + // 'MLA International Bibliography', + // ]; + // let expectedBelowFold = [ + // 'Ethnic NewsWatch', + // 'Latin American Women Writers', + // 'Latino Literature', + // ]; + // expect(result.databases.aboveFold.length).toBe(5); + // expect(result.databases.belowFold.length).toBe(3); + // expect(expectedAboveFold.includes(result.databases.aboveFold[0].name)).toBe( + // true + // ); + // expect(expectedAboveFold.includes(result.databases.aboveFold[1].name)).toBe( + // true + // ); + // expect(expectedAboveFold.includes(result.databases.aboveFold[2].name)).toBe( + // true + // ); + // expect(expectedAboveFold.includes(result.databases.aboveFold[3].name)).toBe( + // true + // ); + // expect(expectedAboveFold.includes(result.databases.aboveFold[4].name)).toBe( + // true + // ); + // expect(expectedBelowFold.includes(result.databases.belowFold[0].name)).toBe( + // true + // ); + // expect(expectedBelowFold.includes(result.databases.belowFold[1].name)).toBe( + // true + // ); + // expect(expectedBelowFold.includes(result.databases.belowFold[2].name)).toBe( + // true + // ); + // }); +}); From fec722d24ac3c2653dd8b159434a3b724fa5ac8d Mon Sep 17 00:00:00 2001 From: Ken Irwin Date: Fri, 6 Jun 2025 16:20:55 -0400 Subject: [PATCH 05/23] UserLibGuidesData.test restructured to avoid mutating data during tests --- .../test/UserLibGuidesData.test.js | 248 ++--- .../subjectsAfterFavsAdded/German.json | 648 ++++++++++++ .../subjectsAfterFavsAdded/Spanish.json | 999 ++++++++++++++++++ 3 files changed, 1745 insertions(+), 150 deletions(-) create mode 100644 models/userLoginData/test/sample-data/subjectsAfterFavsAdded/German.json create mode 100644 models/userLoginData/test/sample-data/subjectsAfterFavsAdded/Spanish.json diff --git a/models/userLoginData/test/UserLibGuidesData.test.js b/models/userLoginData/test/UserLibGuidesData.test.js index 95bb87f..91b8310 100644 --- a/models/userLoginData/test/UserLibGuidesData.test.js +++ b/models/userLoginData/test/UserLibGuidesData.test.js @@ -4,163 +4,111 @@ const german = require('./sample-data/subjectsAfterFavsAdded/German.json'); const UserLibGuidesData = require('../UserLibGuidesData'); describe('UserLibGuidesData: separateTopAndFavDatabases', () => { - // it('should test true', () => { - // expect(true).toBe(true); - // }); + describe('separateTopAndFavDatabases: Spanish', () => { + const obj = new UserLibGuidesData(); - // it('should have a databases object thats an array with a filter function (spanish)', () => { - // expect(Array.isArray(spanish.databases)).toBe(true); - // expect(typeof spanish.databases.filter).toBe('function'); - // }); + it('should get a response with databases: [aboveFold, belowFold]', () => { + // Note: `structuredClone` is used to avoid mutating the original data. + const result = obj.separateTopAndFavDatabases(structuredClone(spanish)); + expect(result).toHaveProperty('databases'); + expect(result.databases).toHaveProperty('aboveFold'); + expect(result.databases).toHaveProperty('belowFold'); + }); - it('should get a response from separateTopAndFavDatabases(spanish)', () => { - const obj = new UserLibGuidesData(); - const result = obj.separateTopAndFavDatabases(spanish); - expect(result).toHaveProperty('databases'); - expect(result.databases).toHaveProperty('aboveFold'); - expect(result.databases).toHaveProperty('belowFold'); - expect(Array.isArray(result.databases.aboveFold)).toBe(true); - expect(Array.isArray(result.databases.belowFold)).toBe(true); - expect(result.databases.aboveFold.length).toBe(5); - expect(result.databases.belowFold.length).toBe(3); - }); + it('should get 5 above/3 below', () => { + const result = obj.separateTopAndFavDatabases(structuredClone(spanish)); + expect(Array.isArray(result.databases.aboveFold)).toBe(true); + expect(Array.isArray(result.databases.belowFold)).toBe(true); + expect(result.databases.aboveFold.length).toBe(5); + expect(result.databases.belowFold.length).toBe(3); + }); - it('should get 3 above/2 below from separateTopAndFavDatabases(german)', () => { - const obj = new UserLibGuidesData(); - const result = obj.separateTopAndFavDatabases(german); - let expectedAboveFold = [ - 'Film and Television Literature Index with Full Text', - 'MLA International Bibliography', - 'Linguistics & Language Behavior Abstracts', - ]; - let expectedBelowFold = [ - 'German Life and Letters', - 'Oxford Bibliographies Online: Literary and Critical Theory', - ]; - expect(result).toHaveProperty('databases'); - expect(result.databases).toHaveProperty('aboveFold'); - expect(result.databases).toHaveProperty('belowFold'); - expect(Array.isArray(result.databases.aboveFold)).toBe(true); - expect(Array.isArray(result.databases.belowFold)).toBe(true); - expect(result.databases.aboveFold.length).toBe(3); - expect(result.databases.belowFold.length).toBe(2); - expect(expectedAboveFold.includes(result.databases.aboveFold[0].name)).toBe( - true - ); - expect(expectedAboveFold.includes(result.databases.aboveFold[1].name)).toBe( - true - ); - expect(expectedAboveFold.includes(result.databases.aboveFold[2].name)).toBe( - true - ); - expect(expectedBelowFold.includes(result.databases.belowFold[0].name)).toBe( - true - ); - expect(expectedBelowFold.includes(result.databases.belowFold[1].name)).toBe( - true - ); + it('should have expected databases in aboveFold and belowFold for Spanish', () => { + const result = obj.separateTopAndFavDatabases(structuredClone(spanish)); + let expectedAboveFold = [ + 'Clase and Periodica', + 'Film and Television Literature Index with Full Text', + 'Fuente Academica', + 'Linguistics & Language Behavior Abstracts', + 'MLA International Bibliography', + ]; + let expectedBelowFold = [ + 'Ethnic NewsWatch', + 'Latin American Women Writers', + 'Latino Literature', + ]; + expect( + expectedAboveFold.includes(result.databases.aboveFold[0].name) + ).toBe(true); + expect( + expectedAboveFold.includes(result.databases.aboveFold[1].name) + ).toBe(true); + expect( + expectedAboveFold.includes(result.databases.aboveFold[2].name) + ).toBe(true); + expect( + expectedAboveFold.includes(result.databases.aboveFold[3].name) + ).toBe(true); + expect( + expectedAboveFold.includes(result.databases.aboveFold[4].name) + ).toBe(true); + expect( + expectedBelowFold.includes(result.databases.belowFold[0].name) + ).toBe(true); + expect( + expectedBelowFold.includes(result.databases.belowFold[1].name) + ).toBe(true); + expect( + expectedBelowFold.includes(result.databases.belowFold[2].name) + ).toBe(true); + }); }); - // German: - // favs: ['Film and Television Literature Index with Full Text','MLA International Bibliography'] - // top: ['Linguistics & Language Behavior Abstracts','MLA International Bibliography'] - // others: ['German Life and Letters','Oxford Bibliographies Online: Literary and Critical Theory'] + describe('separateTopAndFavDatabases: German', () => { + const obj = new UserLibGuidesData(); - // it('should have aboveFold and belowFold properties for German', () => { - // const result = obj.separateTopAndFavDatabases(german); - // expect(result).toHaveProperty('databases.aboveFold'); - // expect(result).toHaveProperty('databases.belowFold'); - // }); - // it('should find 3 databases aboveFold in German, 2 belowFold', () => { - // const result = obj.separateTopAndFavDatabases(german); - // let expectedAboveFold = [ - // 'Linguistics & Language Behavior Abstracts', - // 'MLA International Bibliography', - // 'Linguistics & Language Behavior Abstracts', - // ]; - // let expectedBelowFold = [ - // 'German Life and Letters', - // 'Oxford Bibliographies Online: Literary and Critical Theory', - // ]; - // expect(result.databases.aboveFold.length).toBe(3); - // expect(result.databases.belowFold.length).toBe(2); - // expect(expectedAboveFold.includes(result.databases.aboveFold[0].name)).toBe( - // true - // ); - // expect(expectedAboveFold.includes(result.databases.aboveFold[1].name)).toBe( - // true - // ); - // expect(expectedAboveFold.includes(result.databases.aboveFold[2].name)).toBe( - // true - // ); - // expect(expectedBelowFold.includes(result.databases.belowFold[0].name)).toBe( - // true - // ); - // expect(expectedBelowFold.includes(result.databases.belowFold[1].name)).toBe( - // true - // ); - // }); + it('should get a response with databases: [aboveFold, belowFold]', () => { + const result = obj.separateTopAndFavDatabases(structuredClone(german)); + expect(result).toHaveProperty('databases'); + expect(result.databases).toHaveProperty('aboveFold'); + expect(result.databases).toHaveProperty('belowFold'); + }); - // // Spanish: - // // favs: ["Clase and Periodica","Fuente Academica"] - // // top: [ - // // "Film and Television Literature Index with Full Text", - // // "Linguistics & Language Behavior Abstracts" - // // "MLA International Bibliography" - // // ] - // // others: ['Ethnic NewsWatch','Latin American Women Writers','Latino Literature'] + it('should get 5 above/3 below', () => { + const result = obj.separateTopAndFavDatabases(structuredClone(german)); + expect(Array.isArray(result.databases.aboveFold)).toBe(true); + expect(Array.isArray(result.databases.belowFold)).toBe(true); + expect(result.databases.aboveFold.length).toBe(3); + expect(result.databases.belowFold.length).toBe(2); + }); - // it('should have a databases object thats an array', () => { - // expect(Array.isArray(spanish.databases)).toBe(true); - // }); - // it('should have a filter function on th databases array', () => { - // expect(typeof spanish.databases.filter).toBe('function'); - // }); - // it('should have aboveFold and belowFold properties for Spanish', () => { - // const result = obj.separateTopAndFavDatabases(spanish); - // expect(result).toHaveProperty('databases.aboveFold'); - // expect(result).toHaveProperty('databases.belowFold'); - // }); + it('should have expected databases in aboveFold and belowFold for German', () => { + const result = obj.separateTopAndFavDatabases(structuredClone(german)); - // it('should find 5 databases aboveFold in Spanish, 3 belowFold', () => { - // const result = obj.separateTopAndFavDatabases(spanish); - // let expectedAboveFold = [ - // 'Clase and Periodica', - // 'Film and Television Literature Index with Full Text', - // 'Fuente Academica', - // 'Linguistics & Language Behavior Abstracts', - // 'MLA International Bibliography', - // ]; - // let expectedBelowFold = [ - // 'Ethnic NewsWatch', - // 'Latin American Women Writers', - // 'Latino Literature', - // ]; - // expect(result.databases.aboveFold.length).toBe(5); - // expect(result.databases.belowFold.length).toBe(3); - // expect(expectedAboveFold.includes(result.databases.aboveFold[0].name)).toBe( - // true - // ); - // expect(expectedAboveFold.includes(result.databases.aboveFold[1].name)).toBe( - // true - // ); - // expect(expectedAboveFold.includes(result.databases.aboveFold[2].name)).toBe( - // true - // ); - // expect(expectedAboveFold.includes(result.databases.aboveFold[3].name)).toBe( - // true - // ); - // expect(expectedAboveFold.includes(result.databases.aboveFold[4].name)).toBe( - // true - // ); - // expect(expectedBelowFold.includes(result.databases.belowFold[0].name)).toBe( - // true - // ); - // expect(expectedBelowFold.includes(result.databases.belowFold[1].name)).toBe( - // true - // ); - // expect(expectedBelowFold.includes(result.databases.belowFold[2].name)).toBe( - // true - // ); - // }); + let expectedAboveFold = [ + 'Film and Television Literature Index with Full Text', + 'MLA International Bibliography', + 'Linguistics & Language Behavior Abstracts', + ]; + let expectedBelowFold = [ + 'German Life and Letters', + 'Oxford Bibliographies Online: Literary and Critical Theory', + ]; + expect( + expectedAboveFold.includes(result.databases.aboveFold[0].name) + ).toBe(true); + expect( + expectedAboveFold.includes(result.databases.aboveFold[1].name) + ).toBe(true); + expect( + expectedAboveFold.includes(result.databases.aboveFold[2].name) + ).toBe(true); + expect( + expectedBelowFold.includes(result.databases.belowFold[0].name) + ).toBe(true); + expect( + expectedBelowFold.includes(result.databases.belowFold[1].name) + ).toBe(true); + }); + }); }); diff --git a/models/userLoginData/test/sample-data/subjectsAfterFavsAdded/German.json b/models/userLoginData/test/sample-data/subjectsAfterFavsAdded/German.json new file mode 100644 index 0000000..8299e1d --- /dev/null +++ b/models/userLoginData/test/sample-data/subjectsAfterFavsAdded/German.json @@ -0,0 +1,648 @@ +{ + "metadata": { + "sizeof": { + "librarians": 1, + "guides": 1, + "databases": 5 + } + }, + "subjects": [ + { + "id": "197870", + "name": "German", + "parent_id": "0", + "slug": "subject-german", + "slug_id": "2226570" + } + ], + "librarians": [ + { + "created": "2009-03-27 22:59:37", + "created_by": 0, + "email": "gibsonke@miamioh.edu", + "first_name": "Katie", + "id": 8191, + "last_name": "Gibson", + "login_fail_cnt": 0, + "nickname": "", + "profile": { + "account_id": 8191, + "box": { + "title": "Subject Guide" + }, + "connect": { + "address": "203 King Library", + "email": "gibsonke@miamioh.edu", + "facebook": "", + "linkedin": "", + "phone": "513-529-0190", + "skype": "", + "twitter": "", + "website": "" + }, + "created": "2014-05-26 13:56:34", + "customer_id": 583, + "display": { + "disp_connect_general": "1", + "disp_widget_la": "1", + "disp_widget_lc": "1", + "disp_widget_other": "1" + }, + "en_page": 1, + "id": 5522, + "image": { + "file": "Gibson.png", + "show": 1, + "url": "//d2jv02qf7xgjwx.cloudfront.net/accounts/8191/profiles/5522/Gibson.png" + }, + "page": { + "redirect": "", + "working": "" + }, + "pronouns": "she/her", + "public_id": "58aa3206-7cdb-11ed-9922-0ad758b798c3", + "updated": "2023-02-06 13:48:34", + "url": "https://libguides.lib.miamioh.edu/prf.php?id=58aa3206-7cdb-11ed-9922-0ad758b798c3", + "widget_la": "\n", + "widget_lc": "\n\n\n\n\n", + "widget_other": "" + }, + "signature": "", + "subjects": [ + { + "id": 8452, + "name": "Area Studies", + "slug_id": 0 + }, + { + "id": 11160, + "name": "Asian Studies", + "slug_id": 0 + }, + { + "id": 11173, + "name": "Asian-American Studies", + "slug_id": 0 + }, + { + "id": 8442, + "name": "Black World Studies", + "slug_id": 0 + }, + { + "id": 197867, + "name": "French", + "slug_id": 2226566 + }, + { + "id": 197870, + "name": "German", + "slug_id": 2226570 + }, + { + "id": 75002, + "name": "Global and Intercultural Studies", + "slug_id": 0 + }, + { + "id": 8454, + "name": "International Studies", + "slug_id": 0 + }, + { + "id": 197869, + "name": "Italian", + "slug_id": 2226569 + }, + { + "id": 8445, + "name": "Languages", + "slug_id": 0 + }, + { + "id": 11162, + "name": "Latin American Studies", + "slug_id": 0 + }, + { + "id": 11159, + "name": "Middle East and Islamic Studies", + "slug_id": 0 + }, + { + "id": 11171, + "name": "Russian, Eastern European, and Eurasian Studies", + "slug_id": 0 + }, + { + "id": 197868, + "name": "Spanish and Portuguese", + "slug_id": 2226568 + }, + { + "id": 205333, + "name": "Western (Individualized Studies)", + "slug_id": 2383676 + } + ], + "title": "Humanities Librarian", + "updated": "2020-06-29 12:24:25", + "uuid": "d34db637-780e-11e9-8e95-12e47270be0e", + "isTopForSubject": false + } + ], + "guides": [ + { + "count_hit": 81, + "created": "2009-06-09 22:37:25", + "description": "", + "friendly_url": "https://libguides.lib.miamioh.edu/german", + "group_id": 0, + "id": 22097, + "name": "German", + "nav_type": 1, + "owner_id": 8191, + "published": "2009-06-10 22:50:30", + "redirect_url": "", + "site_id": 594, + "slug": "german", + "slug_id": 22378, + "status": 1, + "status_label": "Published", + "subjects": [ + { + "id": 197870, + "name": "German", + "slug_id": 2226570 + }, + { + "id": 8445, + "name": "Languages", + "slug_id": 0 + } + ], + "thumbnail_url": "", + "type_id": 3, + "type_label": "Subject Guide", + "updated": "2025-02-07 15:14:34", + "url": "https://libguides.lib.miamioh.edu/c.php?g=22097", + "isTopForSubject": false, + "favorite": false + } + ], + "databases": [ + { + "az_vendor_id": 1110, + "created": "2011-02-18 23:58:58", + "description": "Film & Television Literature Index is an index to articles in popular and scholarly journals about film and television. The publications indexed include international film journals, popular and trade journals, and reference books, and subject coverage includes film & television theory, preservation & restoration, writing, production, cinematography, technical aspects, and reviews.", + "enable_hidden": false, + "friendly_url": "https://libguides.lib.miamioh.edu/film-and-television-literature-index-full-text", + "id": 744190, + "meta": { + "desc_pos": 1, + "enable_proxy": 1, + "more_info": "For reviews see Academic Search Complete or Readers Guide Retrospective; for scholarly articles see also the MLA International Bibliography.", + "target": "0", + "tn_alt_text": "", + "tn_height": "", + "tn_url": "", + "tn_width": "" + }, + "name": "Film and Television Literature Index with Full Text", + "owner_id": 70645, + "site_id": 594, + "slug_id": 1818612, + "subjects": [ + { + "content_id": 744190, + "featured": 0, + "id": 175759, + "name": "Disability Studies", + "ordering": 0, + "parent_id": 0, + "site_id": 594, + "slug_id": 1874198, + "subject_id": 175759 + }, + { + "content_id": 744190, + "featured": 1, + "id": 197867, + "name": "French", + "ordering": 0, + "parent_id": 0, + "site_id": 594, + "slug_id": 2226566, + "subject_id": 197867 + }, + { + "content_id": 744190, + "featured": 1, + "id": 197870, + "name": "German", + "ordering": 0, + "parent_id": 0, + "site_id": 594, + "slug_id": 2226570, + "subject_id": 197870 + }, + { + "content_id": 744190, + "featured": 1, + "id": 197869, + "name": "Italian", + "ordering": 0, + "parent_id": 0, + "site_id": 594, + "slug_id": 2226569, + "subject_id": 197869 + }, + { + "content_id": 744190, + "featured": 0, + "id": 8445, + "name": "Languages", + "ordering": 0, + "parent_id": 0, + "site_id": 594, + "slug_id": 0, + "subject_id": 8445 + }, + { + "content_id": 744190, + "featured": 0, + "id": 25116, + "name": "Media, Journalism, and Film", + "ordering": 0, + "parent_id": 0, + "site_id": 594, + "slug_id": 0, + "subject_id": 25116 + }, + { + "content_id": 744190, + "featured": 1, + "id": 197868, + "name": "Spanish and Portuguese", + "ordering": 0, + "parent_id": 0, + "site_id": 594, + "slug_id": 2226568, + "subject_id": 197868 + } + ], + "type_id": 10, + "updated": "2021-08-30 19:22:12", + "url": "https://search.ebscohost.com/login.aspx?authtype=ip,uid&profile=ehost&defaultdb=f3h", + "isTopForSubject": true, + "favorite": true + }, + { + "az_vendor_id": 4517, + "created": "2011-02-18 23:58:58", + "description": "A cumulative index to the journal German Life and Letters, with names and subject indexes. Limited full-text availability.", + "enable_hidden": false, + "friendly_url": "https://libguides.lib.miamioh.edu/german-life-and-letters", + "id": 744199, + "meta": { + "desc_pos": 1, + "enable_proxy": 1, + "more_info": "", + "target": "0", + "tn_alt_text": "", + "tn_height": "", + "tn_url": "", + "tn_width": "" + }, + "name": "German Life and Letters", + "owner_id": 70645, + "site_id": 594, + "slug_id": 1818629, + "subjects": [ + { + "content_id": 744199, + "featured": 0, + "id": 197870, + "name": "German", + "ordering": 0, + "parent_id": 0, + "site_id": 594, + "slug_id": 2226570, + "subject_id": 197870 + }, + { + "content_id": 744199, + "featured": 0, + "id": 8445, + "name": "Languages", + "ordering": 0, + "parent_id": 0, + "site_id": 594, + "slug_id": 0, + "subject_id": 8445 + } + ], + "type_id": 10, + "updated": "2021-08-30 19:46:37", + "url": "https://onlinelibrary.wiley.com/loi/14680483", + "isTopForSubject": false, + "favorite": false + }, + { + "az_vendor_id": 1111, + "created": "2011-02-18 23:58:59", + "description": "Abstracts and indexes the international literature in linguistics and related disciplines in the language sciences covering all aspects of the study of language including phonetics, phonology, morphology, syntax, and semantics. Complete coverage is given to various fields of linguistics including descriptive, historical, comparative, theoretical and geographical linguistics. No full-text.", + "enable_hidden": false, + "friendly_url": "https://libguides.lib.miamioh.edu/linguistics-language-behavior-abstracts", + "id": 744260, + "meta": { + "desc_pos": 1, + "enable_proxy": 1, + "more_info": "", + "target": "0", + "tn_alt_text": "", + "tn_height": "", + "tn_url": "", + "tn_width": "" + }, + "name": "Linguistics & Language Behavior Abstracts", + "owner_id": 70645, + "site_id": 594, + "slug_id": 1818714, + "subjects": [ + { + "content_id": 744260, + "featured": 1, + "id": 197867, + "name": "French", + "ordering": 0, + "parent_id": 0, + "site_id": 594, + "slug_id": 2226566, + "subject_id": 197867 + }, + { + "content_id": 744260, + "featured": 1, + "id": 197870, + "name": "German", + "ordering": 0, + "parent_id": 0, + "site_id": 594, + "slug_id": 2226570, + "subject_id": 197870 + }, + { + "content_id": 744260, + "featured": 0, + "id": 8445, + "name": "Languages", + "ordering": 0, + "parent_id": 0, + "site_id": 594, + "slug_id": 0, + "subject_id": 8445 + }, + { + "content_id": 744260, + "featured": 1, + "id": 197868, + "name": "Spanish and Portuguese", + "ordering": 0, + "parent_id": 0, + "site_id": 594, + "slug_id": 2226568, + "subject_id": 197868 + }, + { + "content_id": 744260, + "featured": 0, + "id": 8457, + "name": "Speech Pathology and Audiology", + "ordering": 0, + "parent_id": 0, + "site_id": 594, + "slug_id": 0, + "subject_id": 8457 + } + ], + "type_id": 10, + "updated": "2021-08-31 14:41:16", + "url": "https://search.proquest.com/llba?accountid=12434", + "isTopForSubject": true, + "favorite": false + }, + { + "az_vendor_id": 1110, + "created": "2011-02-18 23:58:59", + "description": "An index to scholarly articles, books and book chapters, and dissertations published internationally on modern (Medieval to today) languages, literatures, folklore, and linguistics (including composition and rhetoric since 2000). Coverage has varied but now includes literature from all over the world--Africa, Asia, Australia, Europe, and North and South America. Folklore is represented by folk literature, music, art, rituals, and belief systems. Linguistics and language materials range from history and theory of linguistics, comparative linguistics, semantics, stylistics, and syntax to translation. Other topics include literary theory and criticism, dramatic arts (film, radio, television, theater), and history of printing and publishing. Some full-text.", + "enable_hidden": false, + "friendly_url": "https://libguides.lib.miamioh.edu/mla-international-bibliography", + "id": 744278, + "meta": { + "desc_pos": 1, + "enable_proxy": 1, + "more_info": "", + "target": "0", + "tn_alt_text": "", + "tn_height": "", + "tn_url": "", + "tn_width": "" + }, + "name": "MLA International Bibliography", + "owner_id": 70645, + "site_id": 594, + "slug_id": 1818745, + "subjects": [ + { + "content_id": 744278, + "featured": 1, + "id": 11160, + "name": "Asian Studies", + "ordering": 0, + "parent_id": 0, + "site_id": 594, + "slug_id": 0, + "subject_id": 11160 + }, + { + "content_id": 744278, + "featured": 1, + "id": 11173, + "name": "Asian-American Studies", + "ordering": 0, + "parent_id": 0, + "site_id": 594, + "slug_id": 0, + "subject_id": 11173 + }, + { + "content_id": 744278, + "featured": 1, + "id": 8447, + "name": "English", + "ordering": 0, + "parent_id": 0, + "site_id": 594, + "slug_id": 0, + "subject_id": 8447 + }, + { + "content_id": 744278, + "featured": 1, + "id": 197867, + "name": "French", + "ordering": 0, + "parent_id": 0, + "site_id": 594, + "slug_id": 2226566, + "subject_id": 197867 + }, + { + "content_id": 744278, + "featured": 1, + "id": 197870, + "name": "German", + "ordering": 0, + "parent_id": 0, + "site_id": 594, + "slug_id": 2226570, + "subject_id": 197870 + }, + { + "content_id": 744278, + "featured": 1, + "id": 197869, + "name": "Italian", + "ordering": 0, + "parent_id": 0, + "site_id": 594, + "slug_id": 2226569, + "subject_id": 197869 + }, + { + "content_id": 744278, + "featured": 0, + "id": 8445, + "name": "Languages", + "ordering": 0, + "parent_id": 0, + "site_id": 594, + "slug_id": 0, + "subject_id": 8445 + }, + { + "content_id": 744278, + "featured": 1, + "id": 197868, + "name": "Spanish and Portuguese", + "ordering": 0, + "parent_id": 0, + "site_id": 594, + "slug_id": 2226568, + "subject_id": 197868 + }, + { + "content_id": 744278, + "featured": 1, + "id": 8439, + "name": "Theatre", + "ordering": 0, + "parent_id": 0, + "site_id": 594, + "slug_id": 0, + "subject_id": 8439 + } + ], + "type_id": 10, + "updated": "2021-08-31 15:14:42", + "url": "https://search.ebscohost.com/login.aspx?authtype=ip,uid&profile=ehost&defaultdb=mzh", + "isTopForSubject": true, + "favorite": true + }, + { + "az_vendor_id": 4515, + "created": "2023-07-05 19:40:42", + "description": "Developed cooperatively with scholars and librarians worldwide, Oxford Bibliographies offers exclusive, authoritative research guides across a variety of subject areas. Combining the best features of an annotated bibliography and a high-level encyclopedia, this cutting-edge resource directs researchers to the best available scholarship across a wide variety of subjects.", + "enable_hidden": false, + "friendly_url": "https://libguides.lib.miamioh.edu/Literary_and_Critical_Theory", + "id": 72470666, + "meta": { + "desc_pos": "1", + "enable_proxy": 1, + "more_info": "", + "target": "0", + "tn_alt_text": "", + "tn_height": "", + "tn_url": "", + "tn_width": "" + }, + "name": "Oxford Bibliographies Online: Literary and Critical Theory", + "owner_id": 8191, + "site_id": 594, + "slug_id": 2984016, + "subjects": [ + { + "content_id": 72470666, + "featured": 2, + "id": 8447, + "name": "English", + "ordering": 0, + "parent_id": 0, + "site_id": 594, + "slug_id": 0, + "subject_id": 8447 + }, + { + "content_id": 72470666, + "featured": 2, + "id": 197867, + "name": "French", + "ordering": 0, + "parent_id": 0, + "site_id": 594, + "slug_id": 2226566, + "subject_id": 197867 + }, + { + "content_id": 72470666, + "featured": 2, + "id": 197870, + "name": "German", + "ordering": 0, + "parent_id": 0, + "site_id": 594, + "slug_id": 2226570, + "subject_id": 197870 + }, + { + "content_id": 72470666, + "featured": 2, + "id": 197869, + "name": "Italian", + "ordering": 0, + "parent_id": 0, + "site_id": 594, + "slug_id": 2226569, + "subject_id": 197869 + }, + { + "content_id": 72470666, + "featured": 2, + "id": 197868, + "name": "Spanish and Portuguese", + "ordering": 0, + "parent_id": 0, + "site_id": 594, + "slug_id": 2226568, + "subject_id": 197868 + } + ], + "type_id": 10, + "updated": "2024-02-05 21:59:52", + "url": "https://www.oxfordbibliographies.com/browse?module_0=obo-9780190221911", + "isTopForSubject": false, + "favorite": false + } + ] +} \ No newline at end of file diff --git a/models/userLoginData/test/sample-data/subjectsAfterFavsAdded/Spanish.json b/models/userLoginData/test/sample-data/subjectsAfterFavsAdded/Spanish.json new file mode 100644 index 0000000..46512d9 --- /dev/null +++ b/models/userLoginData/test/sample-data/subjectsAfterFavsAdded/Spanish.json @@ -0,0 +1,999 @@ +{ + "metadata": { + "sizeof": { + "librarians": 1, + "guides": 1, + "databases": 14 + } + }, + "subjects": [ + { + "id": "197868", + "name": "Spanish and Portuguese", + "parent_id": "0", + "slug": "spanish-portuguese", + "slug_id": "2226568" + } + ], + "librarians": [ + { + "created": "2009-03-27 22:59:37", + "created_by": 0, + "email": "gibsonke@miamioh.edu", + "first_name": "Katie", + "id": 8191, + "last_name": "Gibson", + "login_fail_cnt": 0, + "nickname": "", + "profile": { + "account_id": 8191, + "box": { + "title": "Subject Guide" + }, + "connect": { + "address": "203 King Library", + "email": "gibsonke@miamioh.edu", + "facebook": "", + "linkedin": "", + "phone": "513-529-0190", + "skype": "", + "twitter": "", + "website": "" + }, + "created": "2014-05-26 13:56:34", + "customer_id": 583, + "display": { + "disp_connect_general": "1", + "disp_widget_la": "1", + "disp_widget_lc": "1", + "disp_widget_other": "1" + }, + "en_page": 1, + "id": 5522, + "image": { + "file": "Gibson.png", + "show": 1, + "url": "//d2jv02qf7xgjwx.cloudfront.net/accounts/8191/profiles/5522/Gibson.png" + }, + "page": { + "redirect": "", + "working": "" + }, + "pronouns": "she/her", + "public_id": "58aa3206-7cdb-11ed-9922-0ad758b798c3", + "updated": "2023-02-06 13:48:34", + "url": "https://libguides.lib.miamioh.edu/prf.php?id=58aa3206-7cdb-11ed-9922-0ad758b798c3", + "widget_la": "\n", + "widget_lc": "\n\n\n\n\n", + "widget_other": "" + }, + "signature": "", + "subjects": [ + { + "id": 8452, + "name": "Area Studies", + "slug_id": 0 + }, + { + "id": 11160, + "name": "Asian Studies", + "slug_id": 0 + }, + { + "id": 11173, + "name": "Asian-American Studies", + "slug_id": 0 + }, + { + "id": 8442, + "name": "Black World Studies", + "slug_id": 0 + }, + { + "id": 197867, + "name": "French", + "slug_id": 2226566 + }, + { + "id": 197870, + "name": "German", + "slug_id": 2226570 + }, + { + "id": 75002, + "name": "Global and Intercultural Studies", + "slug_id": 0 + }, + { + "id": 8454, + "name": "International Studies", + "slug_id": 0 + }, + { + "id": 197869, + "name": "Italian", + "slug_id": 2226569 + }, + { + "id": 8445, + "name": "Languages", + "slug_id": 0 + }, + { + "id": 11162, + "name": "Latin American Studies", + "slug_id": 0 + }, + { + "id": 11159, + "name": "Middle East and Islamic Studies", + "slug_id": 0 + }, + { + "id": 11171, + "name": "Russian, Eastern European, and Eurasian Studies", + "slug_id": 0 + }, + { + "id": 197868, + "name": "Spanish and Portuguese", + "slug_id": 2226568 + }, + { + "id": 205333, + "name": "Western (Individualized Studies)", + "slug_id": 2383676 + } + ], + "title": "Humanities Librarian", + "updated": "2020-06-29 12:24:25", + "uuid": "d34db637-780e-11e9-8e95-12e47270be0e", + "isTopForSubject": false + } + ], + "guides": [ + { + "count_hit": 379, + "created": "2009-05-20 00:52:20", + "description": "", + "friendly_url": "https://libguides.lib.miamioh.edu/SPN", + "group_id": 0, + "id": 22085, + "name": "Spanish and Portuguese", + "nav_type": 1, + "owner_id": 8191, + "published": "2015-08-26 17:29:49", + "redirect_url": "", + "site_id": 594, + "slug": "SPN", + "slug_id": 22367, + "status": 1, + "status_label": "Published", + "subjects": [ + { + "id": 8445, + "name": "Languages", + "slug_id": 0 + }, + { + "id": 197868, + "name": "Spanish and Portuguese", + "slug_id": 2226568 + } + ], + "thumbnail_url": "", + "type_id": 3, + "type_label": "Subject Guide", + "updated": "2025-04-22 18:27:16", + "url": "https://libguides.lib.miamioh.edu/c.php?g=22085", + "isTopForSubject": false, + "favorite": false + } + ], + "databases": [ + { + "az_vendor_id": 11066, + "created": "2011-02-18 23:58:58", + "description": "CLASE indexes documents published in Latin American journals specializing in the social sciences and humanities. PERIODICA covers journals specializing in science and technology. Together, they offer access to citations from documents published in scholarly journals published in the Spanish, Portuguese, French, and English languages from countries in Latin America and the Caribbean. No full-text.", + "enable_hidden": false, + "friendly_url": "https://libguides.lib.miamioh.edu/clase-periodica", + "id": 744126, + "meta": { + "desc_pos": 1, + "enable_proxy": 1, + "more_info": "", + "target": "0", + "tn_alt_text": "", + "tn_height": "", + "tn_url": "", + "tn_width": "" + }, + "name": "Clase and Periodica", + "owner_id": 70645, + "site_id": 594, + "slug_id": 1818517, + "subjects": [ + { + "content_id": 744126, + "featured": 0, + "id": 197867, + "name": "French", + "ordering": 0, + "parent_id": 0, + "site_id": 594, + "slug_id": 2226566, + "subject_id": 197867 + }, + { + "content_id": 744126, + "featured": 0, + "id": 8445, + "name": "Languages", + "ordering": 0, + "parent_id": 0, + "site_id": 594, + "slug_id": 0, + "subject_id": 8445 + }, + { + "content_id": 744126, + "featured": 0, + "id": 11162, + "name": "Latin American Studies", + "ordering": 0, + "parent_id": 0, + "site_id": 594, + "slug_id": 0, + "subject_id": 11162 + }, + { + "content_id": 744126, + "featured": 0, + "id": 197868, + "name": "Spanish and Portuguese", + "ordering": 0, + "parent_id": 0, + "site_id": 594, + "slug_id": 2226568, + "subject_id": 197868 + } + ], + "type_id": 10, + "updated": "2021-08-27 19:48:20", + "url": "https://newfirstsearch.oclc.org/dbname=ClasePeriodica;done=referer;FSIP", + "isTopForSubject": false, + "favorite": true + }, + { + "az_vendor_id": 1111, + "created": "2011-02-18 23:58:58", + "description": "Interdisciplinary and comprehensive full-text database of the newspapers, magazines and journals of the African American, Caribbean, African, Arab and Middle Eastern, Asian and Pacific Islander, European and Eastern European, Hispanic, and Native peoples press.", + "enable_hidden": false, + "friendly_url": "https://libguides.lib.miamioh.edu/ethnic-newswatch", + "id": 744182, + "meta": { + "desc_pos": 1, + "enable_proxy": 1, + "more_info": "", + "target": "0", + "tn_alt_text": "", + "tn_height": "", + "tn_url": "", + "tn_width": "" + }, + "name": "Ethnic NewsWatch", + "owner_id": 70645, + "site_id": 594, + "slug_id": 1818602, + "subjects": [ + { + "content_id": 744182, + "featured": 0, + "id": 8436, + "name": "Anthropology", + "ordering": 0, + "parent_id": 0, + "site_id": 594, + "slug_id": 0, + "subject_id": 8436 + }, + { + "content_id": 744182, + "featured": 0, + "id": 11160, + "name": "Asian Studies", + "ordering": 0, + "parent_id": 0, + "site_id": 594, + "slug_id": 0, + "subject_id": 11160 + }, + { + "content_id": 744182, + "featured": 0, + "id": 11173, + "name": "Asian-American Studies", + "ordering": 0, + "parent_id": 0, + "site_id": 594, + "slug_id": 0, + "subject_id": 11173 + }, + { + "content_id": 744182, + "featured": 0, + "id": 8442, + "name": "Black World Studies", + "ordering": 0, + "parent_id": 0, + "site_id": 594, + "slug_id": 0, + "subject_id": 8442 + }, + { + "content_id": 744182, + "featured": 0, + "id": 8443, + "name": "History", + "ordering": 0, + "parent_id": 0, + "site_id": 594, + "slug_id": 0, + "subject_id": 8443 + }, + { + "content_id": 744182, + "featured": 0, + "id": 8454, + "name": "International Studies", + "ordering": 0, + "parent_id": 0, + "site_id": 594, + "slug_id": 0, + "subject_id": 8454 + }, + { + "content_id": 744182, + "featured": 0, + "id": 8445, + "name": "Languages", + "ordering": 0, + "parent_id": 0, + "site_id": 594, + "slug_id": 0, + "subject_id": 8445 + }, + { + "content_id": 744182, + "featured": 0, + "id": 11162, + "name": "Latin American Studies", + "ordering": 0, + "parent_id": 0, + "site_id": 594, + "slug_id": 0, + "subject_id": 11162 + }, + { + "content_id": 744182, + "featured": 0, + "id": 25116, + "name": "Media, Journalism, and Film", + "ordering": 0, + "parent_id": 0, + "site_id": 594, + "slug_id": 0, + "subject_id": 25116 + }, + { + "content_id": 744182, + "featured": 0, + "id": 4602, + "name": "Political Science", + "ordering": 0, + "parent_id": 0, + "site_id": 594, + "slug_id": 4013, + "subject_id": 4602 + }, + { + "content_id": 744182, + "featured": 0, + "id": 197868, + "name": "Spanish and Portuguese", + "ordering": 0, + "parent_id": 0, + "site_id": 594, + "slug_id": 2226568, + "subject_id": 197868 + }, + { + "content_id": 744182, + "featured": 0, + "id": 8440, + "name": "Women's Gender and Sexuality Studies", + "ordering": 0, + "parent_id": 0, + "site_id": 594, + "slug_id": 0, + "subject_id": 8440 + } + ], + "type_id": 10, + "updated": "2022-03-17 17:21:16", + "url": "https://www.proquest.com/ethnicnewswatch/advanced?accountid=12434", + "isTopForSubject": false, + "favorite": false + }, + { + "az_vendor_id": 1110, + "created": "2011-02-18 23:58:58", + "description": "Film & Television Literature Index is an index to articles in popular and scholarly journals about film and television. The publications indexed include international film journals, popular and trade journals, and reference books, and subject coverage includes film & television theory, preservation & restoration, writing, production, cinematography, technical aspects, and reviews.", + "enable_hidden": false, + "friendly_url": "https://libguides.lib.miamioh.edu/film-and-television-literature-index-full-text", + "id": 744190, + "meta": { + "desc_pos": 1, + "enable_proxy": 1, + "more_info": "For reviews see Academic Search Complete or Readers Guide Retrospective; for scholarly articles see also the MLA International Bibliography.", + "target": "0", + "tn_alt_text": "", + "tn_height": "", + "tn_url": "", + "tn_width": "" + }, + "name": "Film and Television Literature Index with Full Text", + "owner_id": 70645, + "site_id": 594, + "slug_id": 1818612, + "subjects": [ + { + "content_id": 744190, + "featured": 0, + "id": 175759, + "name": "Disability Studies", + "ordering": 0, + "parent_id": 0, + "site_id": 594, + "slug_id": 1874198, + "subject_id": 175759 + }, + { + "content_id": 744190, + "featured": 1, + "id": 197867, + "name": "French", + "ordering": 0, + "parent_id": 0, + "site_id": 594, + "slug_id": 2226566, + "subject_id": 197867 + }, + { + "content_id": 744190, + "featured": 1, + "id": 197870, + "name": "German", + "ordering": 0, + "parent_id": 0, + "site_id": 594, + "slug_id": 2226570, + "subject_id": 197870 + }, + { + "content_id": 744190, + "featured": 1, + "id": 197869, + "name": "Italian", + "ordering": 0, + "parent_id": 0, + "site_id": 594, + "slug_id": 2226569, + "subject_id": 197869 + }, + { + "content_id": 744190, + "featured": 0, + "id": 8445, + "name": "Languages", + "ordering": 0, + "parent_id": 0, + "site_id": 594, + "slug_id": 0, + "subject_id": 8445 + }, + { + "content_id": 744190, + "featured": 0, + "id": 25116, + "name": "Media, Journalism, and Film", + "ordering": 0, + "parent_id": 0, + "site_id": 594, + "slug_id": 0, + "subject_id": 25116 + }, + { + "content_id": 744190, + "featured": 1, + "id": 197868, + "name": "Spanish and Portuguese", + "ordering": 0, + "parent_id": 0, + "site_id": 594, + "slug_id": 2226568, + "subject_id": 197868 + } + ], + "type_id": 10, + "updated": "2021-08-30 19:22:12", + "url": "https://search.ebscohost.com/login.aspx?authtype=ip,uid&profile=ehost&defaultdb=f3h", + "isTopForSubject": true, + "favorite": false + }, + { + "az_vendor_id": 1110, + "created": "2011-02-18 23:58:58", + "description": "Fuente Academica provides full-text (including .pdf) for scholarly Spanish language journals from Spain and Latin America. This multidisciplinary database offers full-text content to many academic areas including business and economics, medical sciences, political science, law, computer science, library and information sciences, literature, linguistics, history, philosophy, and theology.", + "enable_hidden": false, + "friendly_url": "https://libguides.lib.miamioh.edu/fuente-academica", + "id": 744193, + "meta": { + "desc_pos": 1, + "enable_proxy": 1, + "more_info": "", + "target": "0", + "tn_alt_text": "", + "tn_height": "", + "tn_url": "", + "tn_width": "" + }, + "name": "Fuente Academica", + "owner_id": 70645, + "site_id": 594, + "slug_id": 1818618, + "subjects": [ + { + "content_id": 744193, + "featured": 0, + "id": 8445, + "name": "Languages", + "ordering": 0, + "parent_id": 0, + "site_id": 594, + "slug_id": 0, + "subject_id": 8445 + }, + { + "content_id": 744193, + "featured": 0, + "id": 11162, + "name": "Latin American Studies", + "ordering": 0, + "parent_id": 0, + "site_id": 594, + "slug_id": 0, + "subject_id": 11162 + }, + { + "content_id": 744193, + "featured": 0, + "id": 197868, + "name": "Spanish and Portuguese", + "ordering": 0, + "parent_id": 0, + "site_id": 594, + "slug_id": 2226568, + "subject_id": 197868 + } + ], + "type_id": 10, + "updated": "2022-04-20 18:30:16", + "url": "https://search.ebscohost.com/login.aspx?authtype=ip,uid&profile=ehost&defaultdb=zbh", + "isTopForSubject": false, + "favorite": true + }, + { + "az_vendor_id": 1113, + "created": "2011-02-18 23:58:59", + "description": "Latin American Women Writers contains full-text prose, poetry and drama by Latin American Women. Authors are from Mexico and South and Central America. Materials are in Spanish and Portuguese as well as French, Italian and English.", + "enable_hidden": false, + "friendly_url": "https://libguides.lib.miamioh.edu/latin-american-women-writers", + "id": 744248, + "meta": { + "desc_pos": 1, + "enable_proxy": 1, + "more_info": "", + "target": "0", + "tn_alt_text": "", + "tn_height": "", + "tn_url": "", + "tn_width": "" + }, + "name": "Latin American Women Writers", + "owner_id": 70645, + "site_id": 594, + "slug_id": 1818706, + "subjects": [ + { + "content_id": 744248, + "featured": 0, + "id": 8447, + "name": "English", + "ordering": 0, + "parent_id": 0, + "site_id": 594, + "slug_id": 0, + "subject_id": 8447 + }, + { + "content_id": 744248, + "featured": 0, + "id": 197867, + "name": "French", + "ordering": 0, + "parent_id": 0, + "site_id": 594, + "slug_id": 2226566, + "subject_id": 197867 + }, + { + "content_id": 744248, + "featured": 0, + "id": 8443, + "name": "History", + "ordering": 0, + "parent_id": 0, + "site_id": 594, + "slug_id": 0, + "subject_id": 8443 + }, + { + "content_id": 744248, + "featured": 0, + "id": 8445, + "name": "Languages", + "ordering": 0, + "parent_id": 0, + "site_id": 594, + "slug_id": 0, + "subject_id": 8445 + }, + { + "content_id": 744248, + "featured": 0, + "id": 11162, + "name": "Latin American Studies", + "ordering": 0, + "parent_id": 0, + "site_id": 594, + "slug_id": 0, + "subject_id": 11162 + }, + { + "content_id": 744248, + "featured": 0, + "id": 197868, + "name": "Spanish and Portuguese", + "ordering": 0, + "parent_id": 0, + "site_id": 594, + "slug_id": 2226568, + "subject_id": 197868 + }, + { + "content_id": 744248, + "featured": 0, + "id": 8440, + "name": "Women's Gender and Sexuality Studies", + "ordering": 0, + "parent_id": 0, + "site_id": 594, + "slug_id": 0, + "subject_id": 8440 + } + ], + "type_id": 10, + "updated": "2021-08-30 20:35:17", + "url": "https://lit.alexanderstreet.com/laww", + "isTopForSubject": false, + "favorite": false + }, + { + "az_vendor_id": 1113, + "created": "2011-02-18 23:58:59", + "description": "Contains the full-text of poetry, fiction, and drama written in English and Spanish by hundreds of Chicano, Cuban, Puerto Rican, Dominican, and other Latin authors working in the United States.", + "enable_hidden": false, + "friendly_url": "https://libguides.lib.miamioh.edu/latino-literature", + "id": 744249, + "meta": { + "desc_pos": 1, + "enable_proxy": 1, + "more_info": "", + "target": "0", + "tn_alt_text": "", + "tn_height": "", + "tn_url": "", + "tn_width": "" + }, + "name": "Latino Literature", + "owner_id": 70645, + "site_id": 594, + "slug_id": 1818707, + "subjects": [ + { + "content_id": 744249, + "featured": 0, + "id": 8447, + "name": "English", + "ordering": 0, + "parent_id": 0, + "site_id": 594, + "slug_id": 0, + "subject_id": 8447 + }, + { + "content_id": 744249, + "featured": 0, + "id": 8443, + "name": "History", + "ordering": 0, + "parent_id": 0, + "site_id": 594, + "slug_id": 0, + "subject_id": 8443 + }, + { + "content_id": 744249, + "featured": 0, + "id": 8445, + "name": "Languages", + "ordering": 0, + "parent_id": 0, + "site_id": 594, + "slug_id": 0, + "subject_id": 8445 + }, + { + "content_id": 744249, + "featured": 0, + "id": 11162, + "name": "Latin American Studies", + "ordering": 0, + "parent_id": 0, + "site_id": 594, + "slug_id": 0, + "subject_id": 11162 + }, + { + "content_id": 744249, + "featured": 0, + "id": 197868, + "name": "Spanish and Portuguese", + "ordering": 0, + "parent_id": 0, + "site_id": 594, + "slug_id": 2226568, + "subject_id": 197868 + } + ], + "type_id": 10, + "updated": "2021-08-30 20:35:48", + "url": "https://lit.alexanderstreet.com/lali", + "isTopForSubject": false, + "favorite": false + }, + { + "az_vendor_id": 1111, + "created": "2011-02-18 23:58:59", + "description": "Abstracts and indexes the international literature in linguistics and related disciplines in the language sciences covering all aspects of the study of language including phonetics, phonology, morphology, syntax, and semantics. Complete coverage is given to various fields of linguistics including descriptive, historical, comparative, theoretical and geographical linguistics. No full-text.", + "enable_hidden": false, + "friendly_url": "https://libguides.lib.miamioh.edu/linguistics-language-behavior-abstracts", + "id": 744260, + "meta": { + "desc_pos": 1, + "enable_proxy": 1, + "more_info": "", + "target": "0", + "tn_alt_text": "", + "tn_height": "", + "tn_url": "", + "tn_width": "" + }, + "name": "Linguistics & Language Behavior Abstracts", + "owner_id": 70645, + "site_id": 594, + "slug_id": 1818714, + "subjects": [ + { + "content_id": 744260, + "featured": 1, + "id": 197867, + "name": "French", + "ordering": 0, + "parent_id": 0, + "site_id": 594, + "slug_id": 2226566, + "subject_id": 197867 + }, + { + "content_id": 744260, + "featured": 1, + "id": 197870, + "name": "German", + "ordering": 0, + "parent_id": 0, + "site_id": 594, + "slug_id": 2226570, + "subject_id": 197870 + }, + { + "content_id": 744260, + "featured": 0, + "id": 8445, + "name": "Languages", + "ordering": 0, + "parent_id": 0, + "site_id": 594, + "slug_id": 0, + "subject_id": 8445 + }, + { + "content_id": 744260, + "featured": 1, + "id": 197868, + "name": "Spanish and Portuguese", + "ordering": 0, + "parent_id": 0, + "site_id": 594, + "slug_id": 2226568, + "subject_id": 197868 + }, + { + "content_id": 744260, + "featured": 0, + "id": 8457, + "name": "Speech Pathology and Audiology", + "ordering": 0, + "parent_id": 0, + "site_id": 594, + "slug_id": 0, + "subject_id": 8457 + } + ], + "type_id": 10, + "updated": "2021-08-31 14:41:16", + "url": "https://search.proquest.com/llba?accountid=12434", + "isTopForSubject": true, + "favorite": false + }, + { + "az_vendor_id": 1110, + "created": "2011-02-18 23:58:59", + "description": "An index to scholarly articles, books and book chapters, and dissertations published internationally on modern (Medieval to today) languages, literatures, folklore, and linguistics (including composition and rhetoric since 2000). Coverage has varied but now includes literature from all over the world--Africa, Asia, Australia, Europe, and North and South America. Folklore is represented by folk literature, music, art, rituals, and belief systems. Linguistics and language materials range from history and theory of linguistics, comparative linguistics, semantics, stylistics, and syntax to translation. Other topics include literary theory and criticism, dramatic arts (film, radio, television, theater), and history of printing and publishing. Some full-text.", + "enable_hidden": false, + "friendly_url": "https://libguides.lib.miamioh.edu/mla-international-bibliography", + "id": 744278, + "meta": { + "desc_pos": 1, + "enable_proxy": 1, + "more_info": "", + "target": "0", + "tn_alt_text": "", + "tn_height": "", + "tn_url": "", + "tn_width": "" + }, + "name": "MLA International Bibliography", + "owner_id": 70645, + "site_id": 594, + "slug_id": 1818745, + "subjects": [ + { + "content_id": 744278, + "featured": 1, + "id": 11160, + "name": "Asian Studies", + "ordering": 0, + "parent_id": 0, + "site_id": 594, + "slug_id": 0, + "subject_id": 11160 + }, + { + "content_id": 744278, + "featured": 1, + "id": 11173, + "name": "Asian-American Studies", + "ordering": 0, + "parent_id": 0, + "site_id": 594, + "slug_id": 0, + "subject_id": 11173 + }, + { + "content_id": 744278, + "featured": 1, + "id": 8447, + "name": "English", + "ordering": 0, + "parent_id": 0, + "site_id": 594, + "slug_id": 0, + "subject_id": 8447 + }, + { + "content_id": 744278, + "featured": 1, + "id": 197867, + "name": "French", + "ordering": 0, + "parent_id": 0, + "site_id": 594, + "slug_id": 2226566, + "subject_id": 197867 + }, + { + "content_id": 744278, + "featured": 1, + "id": 197870, + "name": "German", + "ordering": 0, + "parent_id": 0, + "site_id": 594, + "slug_id": 2226570, + "subject_id": 197870 + }, + { + "content_id": 744278, + "featured": 1, + "id": 197869, + "name": "Italian", + "ordering": 0, + "parent_id": 0, + "site_id": 594, + "slug_id": 2226569, + "subject_id": 197869 + }, + { + "content_id": 744278, + "featured": 0, + "id": 8445, + "name": "Languages", + "ordering": 0, + "parent_id": 0, + "site_id": 594, + "slug_id": 0, + "subject_id": 8445 + }, + { + "content_id": 744278, + "featured": 1, + "id": 197868, + "name": "Spanish and Portuguese", + "ordering": 0, + "parent_id": 0, + "site_id": 594, + "slug_id": 2226568, + "subject_id": 197868 + }, + { + "content_id": 744278, + "featured": 1, + "id": 8439, + "name": "Theatre", + "ordering": 0, + "parent_id": 0, + "site_id": 594, + "slug_id": 0, + "subject_id": 8439 + } + ], + "type_id": 10, + "updated": "2021-08-31 15:14:42", + "url": "https://search.ebscohost.com/login.aspx?authtype=ip,uid&profile=ehost&defaultdb=mzh", + "isTopForSubject": true, + "favorite": false + } + ] +} \ No newline at end of file From 574984afcaba23b7af8cd24218460fc52f192a13 Mon Sep 17 00:00:00 2001 From: Ken Irwin Date: Fri, 6 Jun 2025 16:30:35 -0400 Subject: [PATCH 06/23] UserLibGuidesData.getSubjectFiles uses separateTopAndFavDatabases (but not used yet in view) --- models/userLoginData/UserLibGuidesData.js | 1 + temp.js | 7 ------- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/models/userLoginData/UserLibGuidesData.js b/models/userLoginData/UserLibGuidesData.js index e0da703..e364137 100644 --- a/models/userLoginData/UserLibGuidesData.js +++ b/models/userLoginData/UserLibGuidesData.js @@ -35,6 +35,7 @@ module.exports = class UserLibGuidesData { } let fileContents = this.getFileContents(filename); fileContents = this.markFavoriteGuidesAndDatabases(fileContents); + fileContents = this.separateTopAndFavDatabases(fileContents); this.subjectData.push({ name: subject, resources: fileContents, diff --git a/temp.js b/temp.js index d0f0a7b..e69de29 100644 --- a/temp.js +++ b/temp.js @@ -1,7 +0,0 @@ -const getUsageData = require('./helpers/getUsageData'); -// const reportUsage = require('./helpers/reportUsage'); -const getRepeatUsers = require('./helpers/getRepeatUsers'); -let data = getUsageData(); - -let report = getRepeatUsers(data, {}); -console.log(report); From a3386eb4f4a52746952fb1239cf2e642f605d626 Mon Sep 17 00:00:00 2001 From: Ken Irwin Date: Fri, 6 Jun 2025 17:00:58 -0400 Subject: [PATCH 07/23] first stab at displaying top and rest of db in view --- views/partials/databases-top.ejs | 51 +++++++++++++++++++++++++++++++- views/partials/subject-info.ejs | 21 ++++++------- 2 files changed, 61 insertions(+), 11 deletions(-) diff --git a/views/partials/databases-top.ejs b/views/partials/databases-top.ejs index a9d585d..8f9b5d4 100644 --- a/views/partials/databases-top.ejs +++ b/views/partials/databases-top.ejs @@ -1,6 +1,17 @@ +
+
+

+ +

+
+
+ +
    - <% databases.forEach(d => { %> + <% databases.aboveFold.forEach(d => { %>
  • <% let url = d.friendly_url %> <% if (url === null) { url = d.url } %> @@ -16,6 +27,44 @@
  • + <% }) %>
+
+
+
+
+

+ +

+
+
+ +
    + <% databases.belowFold.forEach(d => { %> +
  • + <% let url = d.friendly_url %> + <% if (url === null) { url = d.url } %> + <% if (d.favorite) { %> + + <% } else { %> + + <% } %> +   + <%- d.name %> + + + + +
  • + <% }) %> +
+ +
+
+
+ +
\ No newline at end of file diff --git a/views/partials/subject-info.ejs b/views/partials/subject-info.ejs index 2d62878..3b427c8 100644 --- a/views/partials/subject-info.ejs +++ b/views/partials/subject-info.ejs @@ -79,16 +79,17 @@

 Databases

- <% if ( parseInt (subj.resources.metadata.sizeof.databases)> 0) - { %> - <%- include('databases-top', {databases: - subj.resources.databases}) %> - <% } %> - <% if (subj.resources.subjects && - subj.resources.subjects.length> 0) { %> - <%- include('databases-all', {subjects: - subj.resources.subjects}); %> - <% }%> + <% if ( parseInt (subj.resources.metadata.sizeof.databases.aboveFold)> 0) %> + <% { %> + <%- include('databases-top', {databases: subj.resources.databases}) %> + <% } %> + <% /* this section commented out bc all dbs are now shown */ %> + <% if (subj.resources.subjects && + subj.resources.subjects.length> 0) { %> + <%- // include('databases-all', {subjects: + // subj.resources.subjects}); + %> + <% }%>
From 64ac2bead642c28075259e0f63e19fb5ec977141 Mon Sep 17 00:00:00 2001 From: Ken Irwin Date: Mon, 9 Jun 2025 11:49:38 -0400 Subject: [PATCH 08/23] update top-db accordion ids in view --- views/partials/databases-top.ejs | 14 +++++++------- views/partials/subject-info.ejs | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/views/partials/databases-top.ejs b/views/partials/databases-top.ejs index 8f9b5d4..20a4181 100644 --- a/views/partials/databases-top.ejs +++ b/views/partials/databases-top.ejs @@ -1,12 +1,12 @@ -
+
-

-

-
+
@@ -34,12 +34,12 @@
-

-

-
+
    diff --git a/views/partials/subject-info.ejs b/views/partials/subject-info.ejs index 3b427c8..1e74837 100644 --- a/views/partials/subject-info.ejs +++ b/views/partials/subject-info.ejs @@ -81,7 +81,7 @@
    <% if ( parseInt (subj.resources.metadata.sizeof.databases.aboveFold)> 0) %> <% { %> - <%- include('databases-top', {databases: subj.resources.databases}) %> + <%- include('databases-top', {databases: subj.resources.databases, subjName: subj.name}) %> <% } %> <% /* this section commented out bc all dbs are now shown */ %> <% if (subj.resources.subjects && From 2c7e38220266e852d493616cde9428ce0747f7bc Mon Sep 17 00:00:00 2001 From: Ken Irwin Date: Mon, 9 Jun 2025 12:22:32 -0400 Subject: [PATCH 09/23] add databases-other view, with database-item --- views/partials/database-item.ejs | 14 ++++++++++++++ views/partials/databases-other.ejs | 7 +++++++ 2 files changed, 21 insertions(+) create mode 100644 views/partials/database-item.ejs create mode 100644 views/partials/databases-other.ejs diff --git a/views/partials/database-item.ejs b/views/partials/database-item.ejs new file mode 100644 index 0000000..b29d1e1 --- /dev/null +++ b/views/partials/database-item.ejs @@ -0,0 +1,14 @@ +
  • + <% let url = d.friendly_url %> + <% if (url === null) { url = d.url } %> + <% if (d.favorite) { %> + + <% } else { %> + + <% } %> +   + <%- d.name %> + + + +
  • \ No newline at end of file diff --git a/views/partials/databases-other.ejs b/views/partials/databases-other.ejs new file mode 100644 index 0000000..91da06c --- /dev/null +++ b/views/partials/databases-other.ejs @@ -0,0 +1,7 @@ + +
      + <% databases.belowFold.forEach(d => { %> + <%- include('database-item', {d: d}) %> + <% }) %> +
    + \ No newline at end of file From 96068b0c23ff03a838f5d9d2924a80754857977e Mon Sep 17 00:00:00 2001 From: Ken Irwin Date: Mon, 9 Jun 2025 12:23:44 -0400 Subject: [PATCH 10/23] use databases-other in subject-info view --- views/partials/subject-info.ejs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/views/partials/subject-info.ejs b/views/partials/subject-info.ejs index 1e74837..d033408 100644 --- a/views/partials/subject-info.ejs +++ b/views/partials/subject-info.ejs @@ -79,8 +79,10 @@

     Databases

    - <% if ( parseInt (subj.resources.metadata.sizeof.databases.aboveFold)> 0) %> - <% { %> + <% if (subj.resources.databases.aboveFold.length == 0) { %> + <%- include('databases-other', {databases: subj.resources.databases, subjName: subj.name, subjects: subj}) %> + + <% } else { %> <%- include('databases-top', {databases: subj.resources.databases, subjName: subj.name}) %> <% } %> <% /* this section commented out bc all dbs are now shown */ %> From 90b710c10325e9d4985894094b5fb26e7efff3d7 Mon Sep 17 00:00:00 2001 From: Ken Irwin Date: Mon, 9 Jun 2025 12:24:29 -0400 Subject: [PATCH 11/23] use database-item in databases-top view (but mysteriously top accordion always starts collapsed) --- views/partials/databases-top.ejs | 37 ++++---------------------------- 1 file changed, 4 insertions(+), 33 deletions(-) diff --git a/views/partials/databases-top.ejs b/views/partials/databases-top.ejs index 20a4181..aa38796 100644 --- a/views/partials/databases-top.ejs +++ b/views/partials/databases-top.ejs @@ -1,5 +1,5 @@ -
    +

    @@ -36,7 +21,7 @@

    @@ -44,21 +29,7 @@
      <% databases.belowFold.forEach(d => { %> -
    • - <% let url = d.friendly_url %> - <% if (url === null) { url = d.url } %> - <% if (d.favorite) { %> - - <% } else { %> - - <% } %> -   - <%- d.name %> - - - - -
    • + <%- include('database-item', {d: d}) %> <% }) %>
    From e00ad9054b515f47e73a3b2a9ad6d6f684bdfc68 Mon Sep 17 00:00:00 2001 From: Ken Irwin Date: Mon, 9 Jun 2025 14:16:42 -0400 Subject: [PATCH 12/23] deconflict collapseCirc with database accordion collapse --- views/index.ejs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/views/index.ejs b/views/index.ejs index e6456b1..41aa0af 100644 --- a/views/index.ejs +++ b/views/index.ejs @@ -3,7 +3,7 @@