MCPcopy Create free account
hub / github.com/TechJeeper/Printventory / processFile

Function processFile

main.js:5788–5924  ·  view source on GitHub ↗
(filePath, index)

Source from the content-addressed store, hash-verified

5786 params.push(v);
5787 posParts.push(`LOWER(TRIM(${column})) = LOWER(TRIM(?))`);
5788 } else {
5789 params.push(v);
5790 posParts.push(`${column} = ?`);
5791 }
5792 }
5793 conditions.push(posParts.length === 1 ? posParts[0] : `(${posParts.join(posJoin)})`);
5794 return;
5795 }
5796 const negJoin = combineOp === 'OR' ? ' AND ' : ' OR ';
5797 const negParts = [];
5798 for (const v of values) {
5799 if (v === '__none__') {
5800 negParts.push(`(${column} IS NOT NULL AND ${column} != '')`);
5801 } else if (useLowerTrim) {
5802 params.push(v);
5803 negParts.push(`(${column} IS NULL OR ${column} = '' OR LOWER(TRIM(${column})) != LOWER(TRIM(?)))`);
5804 } else {
5805 params.push(v);
5806 negParts.push(`(${column} IS NULL OR ${column} = '' OR ${column} != ?)`);
5807 }
5808 }
5809 conditions.push(negParts.length === 1 ? negParts[0] : `(${negParts.join(negJoin)})`);
5810}
5811
5812function pushTagListSQL(conditions, params, filters) {
5813 const tagNames = normalizeTagNameList(filters);
5814 if (!tagNames.length) return false;
5815 const combine = filters.tagCombine === 'AND' ? 'AND' : 'OR';
5816 const inverted = !!filters.tagInverted;
5817 let inner;
5818 if (combine === 'OR') {
5819 const ph = tagNames.map(() => '?').join(', ');
5820 inner = `EXISTS (SELECT 1 FROM model_tags mt INNER JOIN tags t ON t.id = mt.tag_id WHERE mt.model_id = models.id AND t.name IN (${ph}))`;
5821 params.push(...tagNames);
5822 } else {
5823 const existsParts = [];
5824 for (const tn of tagNames) {
5825 params.push(tn);
5826 existsParts.push(
5827 'EXISTS (SELECT 1 FROM model_tags mt INNER JOIN tags t ON t.id = mt.tag_id WHERE mt.model_id = models.id AND t.name = ?)'
5828 );
5829 }
5830 inner = `(${existsParts.join(' AND ')})`;
5831 }
5832 if (inverted) {
5833 conditions.push(`NOT (${inner})`);
5834 } else {
5835 conditions.push(inner);
5836 }
5837 return true;
5838}
5839
5840function normalizeFilamentIdList(filters) {
5841 const raw = [];
5842 if (Array.isArray(filters?.filaments)) raw.push(...filters.filaments);
5843 else if (filters?.filament != null && filters.filament !== '') raw.push(filters.filament);
5844 return raw.map((v) => {
5845 if (v && typeof v === 'object') return Number(v.id);

Callers 1

main.jsFile · 0.70

Calls 2

parseZipPathFunction · 0.70

Tested by

no test coverage detected