mirror of
https://github.com/DRYTRIX/TimeTracker.git
synced 2026-01-04 10:40:23 -06:00
- Improve web interface layout for better user-friendliness and mobile responsiveness * Update CSS variables for consistent spacing and component sizing * Enhance card layouts with improved padding, borders, and shadows * Optimize button and form element dimensions for better touch targets * Add hover effects and animations for improved user interaction * Implement responsive grid system with mobile-first approach - Refactor mobile JavaScript to prevent duplicate initialization * Consolidate mobile enhancements into dedicated utility classes * Add initialization guards to prevent double loading * Implement MobileUtils and MobileNavigation classes * Remove duplicate event listeners and mobile enhancements - Fix circular import issue in logo handling * Replace problematic 'from app import app' with Flask's current_app * Add error handling for cases where current_app is unavailable * Improve logo path resolution with fallback mechanisms * Fix settings model to use proper Flask context - Clean up template code and remove duplication * Remove duplicate mobile enhancements from base template * Clean up dashboard template JavaScript * Centralize all mobile functionality in mobile.js * Add proper error handling and debugging - Update CSS variables and spacing system * Introduce --section-spacing and --card-spacing variables * Add mobile-specific spacing variables * Improve border-radius and shadow consistency * Enhance typography and visual hierarchy This commit resolves the double loading issue and logo import errors while significantly improving the overall user experience and mobile responsiveness of the web interface.
87 lines
3.4 KiB
Python
87 lines
3.4 KiB
Python
#!/usr/bin/env python3
|
|
"""
|
|
Fix script for duplicate columns in settings table
|
|
This script will remove the old company_logo_path column and keep only company_logo_filename
|
|
"""
|
|
|
|
import os
|
|
import sys
|
|
from sqlalchemy import create_engine, text
|
|
|
|
def main():
|
|
"""Fix duplicate columns in settings table"""
|
|
url = os.getenv("DATABASE_URL", "postgresql+psycopg2://timetracker:timetracker@db:5432/timetracker")
|
|
|
|
print(f"Connecting to database: {url}")
|
|
|
|
try:
|
|
engine = create_engine(url, pool_pre_ping=True)
|
|
|
|
with engine.connect() as conn:
|
|
print("=== Fixing duplicate columns in settings table ===")
|
|
|
|
# Check current table structure
|
|
result = conn.execute(text("""
|
|
SELECT column_name
|
|
FROM information_schema.columns
|
|
WHERE table_name = 'settings'
|
|
ORDER BY column_name;
|
|
"""))
|
|
|
|
columns = [row[0] for row in result]
|
|
print(f"Current columns: {columns}")
|
|
|
|
# Check if we have both columns
|
|
has_old_column = 'company_logo_path' in columns
|
|
has_new_column = 'company_logo_filename' in columns
|
|
|
|
if has_old_column and has_new_column:
|
|
print("Found both company_logo_path and company_logo_filename columns")
|
|
print("This will cause confusion. Removing the old company_logo_path column...")
|
|
|
|
# Remove the old column
|
|
conn.execute(text("ALTER TABLE settings DROP COLUMN company_logo_path;"))
|
|
print("✓ Removed old company_logo_path column")
|
|
|
|
elif has_old_column and not has_new_column:
|
|
print("Found only company_logo_path column, renaming to company_logo_filename")
|
|
conn.execute(text("ALTER TABLE settings RENAME COLUMN company_logo_path TO company_logo_filename;"))
|
|
print("✓ Renamed company_logo_path to company_logo_filename")
|
|
|
|
elif has_new_column and not has_old_column:
|
|
print("✓ company_logo_filename column exists, no old column found")
|
|
|
|
else:
|
|
print("Neither column exists, adding company_logo_filename")
|
|
conn.execute(text("ALTER TABLE settings ADD COLUMN company_logo_filename VARCHAR(255) DEFAULT '' NOT NULL;"))
|
|
print("✓ Added company_logo_filename column")
|
|
|
|
# Verify the fix
|
|
result = conn.execute(text("""
|
|
SELECT column_name
|
|
FROM information_schema.columns
|
|
WHERE table_name = 'settings'
|
|
ORDER BY column_name;
|
|
"""))
|
|
|
|
final_columns = [row[0] for row in result]
|
|
print(f"Final columns: {final_columns}")
|
|
|
|
if 'company_logo_filename' in final_columns and 'company_logo_path' not in final_columns:
|
|
print("✓ Duplicate columns issue fixed successfully!")
|
|
print("Only company_logo_filename column remains")
|
|
else:
|
|
print("✗ Failed to fix duplicate columns issue")
|
|
sys.exit(1)
|
|
|
|
conn.commit()
|
|
|
|
except Exception as e:
|
|
print(f"✗ Error: {e}")
|
|
import traceback
|
|
traceback.print_exc()
|
|
sys.exit(1)
|
|
|
|
if __name__ == "__main__":
|
|
main()
|