debugged a endpoint
This commit is contained in:
parent
26717f89f7
commit
b7263188f9
15
combined.log
Normal file
15
combined.log
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
nohup: ignoring input
|
||||||
|
node:internal/modules/cjs/loader:1137
|
||||||
|
throw err;
|
||||||
|
^
|
||||||
|
|
||||||
|
Error: Cannot find module '/mnt/storagessd1tb/changemaker.lite.dev/changemaker.lite/app/server.js'
|
||||||
|
at Module._resolveFilename (node:internal/modules/cjs/loader:1134:15)
|
||||||
|
at Module._load (node:internal/modules/cjs/loader:975:27)
|
||||||
|
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:128:12)
|
||||||
|
at node:internal/main/run_main_module:28:49 {
|
||||||
|
code: 'MODULE_NOT_FOUND',
|
||||||
|
requireStack: []
|
||||||
|
}
|
||||||
|
|
||||||
|
Node.js v18.19.1
|
||||||
@ -1,5 +1,5 @@
|
|||||||
const path = require('path');
|
const path = require('path');
|
||||||
require('dotenv').config();
|
require('dotenv').config({ path: path.join(__dirname, '..', '.env') });
|
||||||
|
|
||||||
// Helper function to parse NocoDB URLs
|
// Helper function to parse NocoDB URLs
|
||||||
function parseNocoDBUrl(url) {
|
function parseNocoDBUrl(url) {
|
||||||
|
|||||||
@ -462,11 +462,78 @@ class ShiftsController {
|
|||||||
// Get signup counts for each shift
|
// Get signup counts for each shift
|
||||||
for (const shift of shifts.list || []) {
|
for (const shift of shifts.list || []) {
|
||||||
try {
|
try {
|
||||||
const signups = await nocodbService.getAll(config.nocodb.shiftSignupsSheetId);
|
// Use getAllPaginated to ensure we get ALL signup records
|
||||||
// Filter signups for this shift manually
|
const signups = await nocodbService.getAllPaginated(config.nocodb.shiftSignupsSheetId);
|
||||||
const shiftSignups = (signups.list || []).filter(signup =>
|
|
||||||
signup['Shift ID'] === shift.ID && signup.Status === 'Confirmed'
|
// Debug logging for shift ID 4 (Sunday Evening Canvass Central Location)
|
||||||
);
|
if (shift.ID === 4) {
|
||||||
|
// Show ALL signups first
|
||||||
|
logger.info(`Debug: Shift ID 4 - All signups from NocoDB (total ${signups.list?.length || 0})`);
|
||||||
|
|
||||||
|
// Show only signups for shift ID 4 (before status filter)
|
||||||
|
const shift4Signups = (signups.list || []).filter(signup =>
|
||||||
|
parseInt(signup['Shift ID']) === 4
|
||||||
|
);
|
||||||
|
logger.info(`Debug: Shift ID 4 - All signups for this shift (${shift4Signups.length}):`);
|
||||||
|
shift4Signups.forEach((s, index) => {
|
||||||
|
logger.info(` Signup ${index + 1}:`, {
|
||||||
|
ID: s.ID,
|
||||||
|
'Shift ID': s['Shift ID'],
|
||||||
|
'Status': `"${s.Status}"`,
|
||||||
|
'Status Length': s.Status ? s.Status.length : 'null',
|
||||||
|
'Status Chars': s.Status ? Array.from(s.Status).map(c => c.charCodeAt(0)) : 'null',
|
||||||
|
'User Email': s['User Email'],
|
||||||
|
'User Name': s['User Name'],
|
||||||
|
'Signup Date': s['Signup Date']
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Filter signups for this shift manually with more robust checking
|
||||||
|
const shiftSignups = (signups.list || []).filter(signup => {
|
||||||
|
// Handle type conversion for Shift ID comparison
|
||||||
|
const signupShiftId = parseInt(signup['Shift ID']);
|
||||||
|
const currentShiftId = parseInt(shift.ID);
|
||||||
|
|
||||||
|
// Only process signups for this specific shift
|
||||||
|
if (signupShiftId !== currentShiftId) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// For shift ID 4, let's check all possible status variations
|
||||||
|
if (currentShiftId === 4) {
|
||||||
|
const signupStatus = (signup.Status || '').toString().trim();
|
||||||
|
const isConfirmed = signupStatus.toLowerCase() === 'confirmed';
|
||||||
|
|
||||||
|
logger.info(`Debug: Shift ID 4 - Checking signup:`, {
|
||||||
|
'User Email': signup['User Email'],
|
||||||
|
'Status Raw': `"${signup.Status}"`,
|
||||||
|
'Status Trimmed': `"${signupStatus}"`,
|
||||||
|
'Status Lower': `"${signupStatus.toLowerCase()}"`,
|
||||||
|
'Is Confirmed': isConfirmed
|
||||||
|
});
|
||||||
|
|
||||||
|
return isConfirmed;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Handle multiple possible "confirmed" status values for other shifts
|
||||||
|
const signupStatus = (signup.Status || '').toString().toLowerCase().trim();
|
||||||
|
const isConfirmed = signupStatus === 'confirmed' || signupStatus === 'active' ||
|
||||||
|
(signupStatus === '' && signup['User Email']); // Include records with empty status if they have an email
|
||||||
|
|
||||||
|
return isConfirmed;
|
||||||
|
});
|
||||||
|
|
||||||
|
// Debug logging for shift ID 4
|
||||||
|
if (shift.ID === 4) {
|
||||||
|
logger.info(`Debug: Shift ID 4 - Filtered signups (${shiftSignups.length}):`, shiftSignups.map(s => ({
|
||||||
|
'Shift ID': s['Shift ID'],
|
||||||
|
'Status': s.Status,
|
||||||
|
'User Email': s['User Email'],
|
||||||
|
'User Name': s['User Name']
|
||||||
|
})));
|
||||||
|
}
|
||||||
|
|
||||||
shift.signups = shiftSignups;
|
shift.signups = shiftSignups;
|
||||||
} catch (signupError) {
|
} catch (signupError) {
|
||||||
logger.error(`Error loading signups for shift ${shift.ID}:`, signupError);
|
logger.error(`Error loading signups for shift ${shift.ID}:`, signupError);
|
||||||
|
|||||||
@ -1,119 +0,0 @@
|
|||||||
# Admin CSS Refactoring
|
|
||||||
|
|
||||||
This directory contains the refactored admin panel CSS, broken down into smaller, more manageable modules for better maintainability.
|
|
||||||
|
|
||||||
## File Structure
|
|
||||||
|
|
||||||
```
|
|
||||||
/css/
|
|
||||||
├── admin.css # Main entry point with imports
|
|
||||||
├── admin.css.backup # Backup of original file
|
|
||||||
└── admin/ # Modular CSS files
|
|
||||||
├── variables.css # CSS variables and theme configuration
|
|
||||||
├── layout.css # Layout components (sidebar, content, navigation)
|
|
||||||
├── forms.css # Form styles and button variations
|
|
||||||
├── status-messages.css # Toast notifications and status indicators
|
|
||||||
├── user-management.css # User tables, forms, and management UI
|
|
||||||
├── walk-sheet.css # Walk sheet preview and QR code components
|
|
||||||
├── data-convert.css # CSV upload and data processing interface
|
|
||||||
├── nocodb-links.css # External database integration cards
|
|
||||||
├── cuts-shifts.css # Cuts and shifts management interface
|
|
||||||
├── modals.css # Modal dialogs and email composition
|
|
||||||
└── responsive.css # Mobile and tablet responsive styles
|
|
||||||
```
|
|
||||||
|
|
||||||
## Module Breakdown
|
|
||||||
|
|
||||||
### variables.css
|
|
||||||
- CSS custom properties for colors, spacing, typography
|
|
||||||
- Theme configuration and z-index layering
|
|
||||||
- Consistent design tokens across the application
|
|
||||||
|
|
||||||
### layout.css
|
|
||||||
- Admin container and sidebar layout
|
|
||||||
- Navigation components and menu items
|
|
||||||
- Desktop layout structure and crosshair utilities
|
|
||||||
|
|
||||||
### forms.css
|
|
||||||
- Form field styles and validation states
|
|
||||||
- Button variations (primary, secondary, danger, etc.)
|
|
||||||
- Input groups and form actions
|
|
||||||
|
|
||||||
### status-messages.css
|
|
||||||
- Toast notification system
|
|
||||||
- Progress bars and loading states
|
|
||||||
- Status icons and success/error indicators
|
|
||||||
|
|
||||||
### user-management.css
|
|
||||||
- User tables with sorting and filtering
|
|
||||||
- User role badges and expiration indicators
|
|
||||||
- Volunteer management components
|
|
||||||
|
|
||||||
### walk-sheet.css
|
|
||||||
- QR code configuration and display
|
|
||||||
- Printable walk sheet layout (8.5x11 paper)
|
|
||||||
- Form field circles and notes sections
|
|
||||||
|
|
||||||
### data-convert.css
|
|
||||||
- CSV file upload interface
|
|
||||||
- Data processing progress indicators
|
|
||||||
- Results preview with map integration
|
|
||||||
|
|
||||||
### nocodb-links.css
|
|
||||||
- External database integration cards
|
|
||||||
- Connection status indicators
|
|
||||||
- Information boxes and documentation
|
|
||||||
|
|
||||||
### cuts-shifts.css
|
|
||||||
- Geographic cuts management
|
|
||||||
- Shift scheduling interface
|
|
||||||
- Map interaction components
|
|
||||||
|
|
||||||
### modals.css
|
|
||||||
- Modal dialog base structure
|
|
||||||
- Email composition with rich text editing
|
|
||||||
- Progress tracking for email campaigns
|
|
||||||
|
|
||||||
### responsive.css
|
|
||||||
- Mobile-first responsive design
|
|
||||||
- Tablet and desktop breakpoints
|
|
||||||
- Touch-friendly interface adaptations
|
|
||||||
|
|
||||||
## Benefits of Refactoring
|
|
||||||
|
|
||||||
1. **Improved Maintainability**: Each module focuses on a specific area of functionality
|
|
||||||
2. **Better Organization**: Styles are logically grouped and easy to find
|
|
||||||
3. **Faster Development**: Developers can work on specific modules without conflicts
|
|
||||||
4. **Easier Debugging**: Issues can be quickly traced to their relevant module
|
|
||||||
5. **Better Performance**: Unused CSS can be more easily identified and removed
|
|
||||||
6. **Consistent Design**: Centralized variables ensure design consistency
|
|
||||||
|
|
||||||
## Usage
|
|
||||||
|
|
||||||
The main `admin.css` file imports all modules automatically. No changes are needed to existing HTML files - the refactoring is transparent to the application.
|
|
||||||
|
|
||||||
## Customization
|
|
||||||
|
|
||||||
To customize the admin interface:
|
|
||||||
|
|
||||||
1. **Colors and Theme**: Modify `variables.css`
|
|
||||||
2. **Layout Changes**: Edit `layout.css`
|
|
||||||
3. **Component Styles**: Update the relevant module (e.g., `forms.css` for button styles)
|
|
||||||
4. **Mobile Experience**: Adjust `responsive.css`
|
|
||||||
|
|
||||||
## File Size Comparison
|
|
||||||
|
|
||||||
- **Original**: ~3,011 lines in single file
|
|
||||||
- **Refactored**: ~11 focused modules averaging ~200-400 lines each
|
|
||||||
- **Total Size**: Approximately the same (no functionality removed)
|
|
||||||
- **Maintainability**: Significantly improved
|
|
||||||
|
|
||||||
## Future Improvements
|
|
||||||
|
|
||||||
Consider these enhancements for continued improvement:
|
|
||||||
|
|
||||||
1. **CSS Variables Expansion**: More granular theming options
|
|
||||||
2. **Component Documentation**: Add component examples and usage guidelines
|
|
||||||
3. **Performance Optimization**: Implement critical CSS loading
|
|
||||||
4. **Design System**: Expand into a full design system with documentation
|
|
||||||
5. **Automated Testing**: Add visual regression testing for UI components
|
|
||||||
@ -1,6 +1,9 @@
|
|||||||
// At the very top of the file, before any requires
|
// At the very top of the file, before any requires
|
||||||
const startTime = Date.now();
|
const startTime = Date.now();
|
||||||
|
|
||||||
|
// Load environment variables first - use the .env file in the map directory
|
||||||
|
require('dotenv').config({ path: require('path').join(__dirname, '..', '.env') });
|
||||||
|
|
||||||
// Use a more robust check for duplicate execution
|
// Use a more robust check for duplicate execution
|
||||||
if (global.__serverInitialized) {
|
if (global.__serverInitialized) {
|
||||||
console.log(`[INIT] Server already initialized - EXITING`);
|
console.log(`[INIT] Server already initialized - EXITING`);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user