Skip to content
Back to skills

1003 Group Table Auto Refresh Fix 7ebf6c0a

ASecurity

**Fixed/Implemented in version: 0.230.057**

  • 9 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added October 11, 2026
businessjavascriptpythonjavaazuretestingapidatabasefrontendbackendperformance

Works with

  • cli
  • api

Security analysis

A100/100

Scanned October 11, 2026

npx -y skills add tools-only/X-Skills --skill 1003-group_table_auto_refresh_fix_7ebf6c0a --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of 1003 Group Table Auto Refresh Fix 7ebf6c0a?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for 1003 Group Table Auto Refresh Fix 7ebf6c0a
[![Security: A β€” Skills Directory](https://www.skillsdirectory.com/api/skills/tools-only-1003-group-table-auto-refresh-fix-7ebf6c0a/badge)](https://www.skillsdirectory.com/skills/tools-only-1003-group-table-auto-refresh-fix-7ebf6c0a)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

SKILL.md
# GROUP TABLE AUTO-REFRESH FIX

**Fixed/Implemented in version: 0.230.057**

## Overview
This fix ensures that when the Control Center data refresh completes, the groups table automatically updates with fresh data without requiring a page refresh. This provides a seamless user experience where storage account sizes, AI search sizes, and last upload dates are immediately visible after refresh.

## Problem Addressed
Previously, after clicking "Refresh Data" in the Control Center, users had to manually reload the page or navigate away and back to see updated group metrics. The storage account calculation wasn't working for groups, and the frontend wasn't automatically refreshing the groups table after a data refresh.

## Root Cause Analysis

### Backend Issues
1. **Storage Account Calculation**: The storage calculation code for groups was nested inside an `except` block, meaning it only ran when there was an error in document metrics calculation
2. **Missing Storage Fallback**: Groups didn't have proper fallback estimation when Azure Storage client wasn't available

### Frontend Issues
1. **Missing Integration**: The `ControlCenter` class didn't have a `loadGroups()` method to integrate with the refresh workflow
2. **Refresh Workflow Gap**: The `refreshActiveTabContent()` function called `window.controlCenter.loadGroups()` but this method didn't exist

## Technical Details

### Files Modified

#### Backend Changes
- `route_backend_control_center.py`: Fixed group storage account calculation logic
- `config.py`: Updated version to 0.230.057

#### Frontend Changes
- `static/js/control-center.js`: Added `loadGroups()` method to `ControlCenter` class

### Storage Account Calculation Fix
**Before**: Storage calculation code was inside `except` block
```python
except Exception as doc_e:
    debug_print(f"❌ [GROUP DOCUMENT DEBUG] Error calculating document metrics...")
    
    # Get actual storage account size... (WRONG LOCATION)
    debug_print(f"πŸ’Ύ [GROUP STORAGE DEBUG] Enhanced citation enabled...")
```

**After**: Storage calculation moved outside `try/except` blocks
```python
except Exception as doc_e:
    debug_print(f"❌ [GROUP DOCUMENT DEBUG] Error calculating document metrics...")

# Get actual storage account size if enhanced citation is enabled (CORRECT LOCATION)
debug_print(f"πŸ’Ύ [GROUP STORAGE DEBUG] Enhanced citation enabled: {app_enhanced_citations}")
```

### Frontend Integration Fix
**Added to ControlCenter class**:
```javascript
async loadGroups() {
    console.log('ControlCenter.loadGroups() called');
    
    try {
        // Call GroupManager's loadGroups method if it exists
        if (typeof GroupManager !== 'undefined' && GroupManager.loadGroups) {
            console.log('Calling GroupManager.loadGroups()');
            await GroupManager.loadGroups();
        } else {
            console.log('GroupManager.loadGroups not available, skipping group refresh');
        }
    } catch (error) {
        console.error('Error loading groups:', error);
    }
}
```

## Refresh Workflow

### Complete Flow
1. **User Action**: User clicks "Refresh Data" button in Control Center
2. **API Call**: Frontend calls `/api/admin/control-center/refresh` (POST)
3. **Backend Processing**: Backend refreshes all user and group metrics with `force_refresh=True`
4. **Metrics Calculation**: 
   - Document counts and AI search sizes recalculated
   - Storage account sizes calculated from Azure Storage (with fallback estimation)
   - Last upload dates formatted correctly (MM/DD/YYYY)
5. **Backend Response**: Returns success with counts of refreshed items
6. **Frontend Refresh**: Calls `refreshActiveTabContent()`
7. **Tab Detection**: Determines active tab and calls appropriate refresh method
8. **Groups Refresh**: If groups tab active, calls `window.controlCenter.loadGroups()`
9. **API Fetch**: `GroupManager.loadGroups()` calls `/api/admin/control-center/groups`
10. **Data Display**: Backend returns groups with cached metrics, frontend updates table

### Data Consistency
- **Refresh Phase**: Uses `force_refresh=True` to recalculate all metrics
- **Display Phase**: Uses `force_refresh=False` to return cached calculated data
- **Storage Calculation**: Uses Azure Storage client with fallback to page-based estimation
- **Date Formatting**: Consistent MM/DD/YYYY format across all group displays

## Testing

### Functional Tests
- `test_group_document_metrics_fix.py`: Validates group metrics calculation
- `test_group_table_auto_refresh.py`: Validates refresh integration workflow

### Manual Testing Steps
1. Open Control Center β†’ Groups tab
2. Note current storage sizes and last upload dates
3. Click "Refresh Data" button
4. Observe that groups table automatically updates with fresh data
5. Verify storage sizes reflect actual Azure Storage usage
6. Confirm last upload dates are properly formatted

## User Experience Improvements

### Before Fix
- ❌ Groups showed 0 KB storage even when files existed
- ❌ Users had to refresh page manually after data refresh
- ❌ Inconsistent data display between refresh operations
- ❌ Storage calculation errors not handled gracefully

### After Fix
- βœ… Groups show accurate storage account sizes
- βœ… Groups table updates automatically after refresh
- βœ… Consistent data across all refresh operations
- βœ… Fallback estimation when Azure Storage unavailable
- βœ… Proper error handling and debug logging

## Performance Considerations

### Optimizations
- **Cached Metrics**: Groups store calculated metrics in database for quick retrieval
- **Batch Processing**: Document calculations processed efficiently
- **Selective Refresh**: Only recalculates when explicitly requested
- **Pagination Support**: Groups API supports pagination for large datasets

### Resource Usage
- **Storage Queries**: Optimized Azure Storage blob listing with prefixes
- **Database Queries**: Separate queries prevent MultipleAggregates issues
- **Index Avoidance**: No ORDER BY clauses to avoid composite index requirements

## Future Enhancements

### Potential Improvements
1. **Real-time Updates**: WebSocket integration for live metric updates
2. **Progressive Refresh**: Refresh individual groups as they complete
3. **Background Processing**: Queue-based metric calculation for large datasets
4. **Caching Strategy**: Redis integration for faster metric retrieval

### Monitoring
- Debug logging available for troubleshooting refresh operations
- Error tracking for storage calculation failures
- Performance metrics for refresh operation timing

## Validation

### Success Criteria
βœ… Storage account calculation runs outside error handling blocks  
βœ… Groups show accurate storage sizes after refresh  
βœ… Frontend automatically updates groups table after refresh  
βœ… No page reload required to see fresh data  
βœ… Proper error handling and fallback mechanisms  
βœ… Consistent date formatting (MM/DD/YYYY)  
βœ… Integration with existing refresh workflow  

### Debug Information
Enhanced debug logging provides visibility into:
- Storage calculation process and results
- Group metrics calculation steps
- Frontend refresh workflow execution
- API call success/failure status
- Data transformation and caching operations

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.