Files
tilbudgivern/backend/find-tag-materials.js
alexpolo1 bdb9e524db Implement manual and automated tests for auto-save countdown feature
- Added a comprehensive manual testing guide for the countdown functionality in `test_countdown_manual.md`.
- Developed a detailed Selenium test suite in `test_countdown_selenium.py` to verify countdown behavior, including server accessibility, login, countdown progression, and UI elements.
- Created a minimal Selenium test version in `test_countdown_selenium_minimal.py` for quick checks without complex setup.
- Introduced a verification script in `test_countdown_verification.py` to analyze code correctness, including server checks, build file existence, and countdown logic.
2025-11-14 11:28:58 +00:00

70 lines
2.1 KiB
JavaScript

require('dotenv').config();
const axios = require('axios');
(async () => {
// Hent alle materialer fra API
const response = await axios.get('http://localhost:4031/api/materials');
const allMaterials = response.data.materials || [];
// Find tag-relaterede materialer
const tagMaterials = allMaterials.filter(m =>
m.name && m.price && parseFloat(m.price) > 0 && (
m.name.toLowerCase().includes('tag') ||
m.name.toLowerCase().includes('tegl') ||
m.name.toLowerCase().includes('skifer') ||
m.name.toLowerCase().includes('eternit') ||
m.name.toLowerCase().includes('bølge') ||
m.name.toLowerCase().includes('plade') ||
m.name.toLowerCase().includes('b7') ||
m.name.toLowerCase().includes('b9') ||
m.name.toLowerCase().includes('trapez')
)
);
console.log('🏠 TAG-MATERIALER I DATABASEN:\n');
// Grupper efter type
const types = {
'Tegl': [],
'Skifer': [],
'B7/Bølgeplade': [],
'B9': [],
'Trapezplade': [],
'Eternit': [],
'Andet': []
};
tagMaterials.forEach(m => {
const name = m.name.toLowerCase();
let type = 'Andet';
if (name.includes('tegl')) type = 'Tegl';
else if (name.includes('skifer')) type = 'Skifer';
else if (name.includes('b7') || name.includes('bølge')) type = 'B7/Bølgeplade';
else if (name.includes('b9')) type = 'B9';
else if (name.includes('trapez')) type = 'Trapezplade';
else if (name.includes('eternit')) type = 'Eternit';
types[type].push(m);
});
Object.keys(types).forEach(type => {
if (types[type].length > 0) {
console.log('\n' + type + ' (' + types[type].length + ' materialer):');
types[type].slice(0, 5).forEach(m => {
console.log(' • ' + m.varenummer + ' - ' + m.name + ' (' + m.price + ' kr)');
});
if (types[type].length > 5) {
console.log(' ... og ' + (types[type].length - 5) + ' flere');
}
}
});
console.log('\n\n📊 SAMMENFATNING:');
Object.keys(types).forEach(type => {
if (types[type].length > 0) {
console.log(' ' + type + ': ' + types[type].length + ' materialer');
}
});
})();