feat: Add interactive map functionality with Leaflet.js
- Implemented interactive map card with expand functionality - Added Leaflet.js integration with OpenStreetMap tiles - Created expandable map modal (80% screen coverage) - Fixed cover image display on community page - Enhanced post detail page with interactive route visualization - Added proper error handling and fallback content - Cleaned up JavaScript structure and removed duplicate code - Updated community index template to use cover images - Added GPX file processing utilities - Fixed indentation error in run.py Map features: - Country-level positioning (Romania default) - Zoom controls and interactive navigation - Test marker with popup functionality - Expandable full-screen view with X button - Clean console logging for debugging - Responsive design with Tailwind CSS styling
This commit is contained in:
41
run.py
41
run.py
@@ -75,11 +75,52 @@ def migrate_db():
|
||||
else:
|
||||
print('page_views table already exists')
|
||||
|
||||
# Check if GPX statistics columns exist
|
||||
result = db.session.execute(text('PRAGMA table_info(gpx_files)'))
|
||||
columns = [row[1] for row in result.fetchall()]
|
||||
|
||||
new_columns = [
|
||||
('total_distance', 'REAL DEFAULT 0.0'),
|
||||
('elevation_gain', 'REAL DEFAULT 0.0'),
|
||||
('max_elevation', 'REAL DEFAULT 0.0'),
|
||||
('min_elevation', 'REAL DEFAULT 0.0'),
|
||||
('total_points', 'INTEGER DEFAULT 0')
|
||||
]
|
||||
|
||||
for column_name, column_type in new_columns:
|
||||
if column_name not in columns:
|
||||
db.session.execute(text(f'ALTER TABLE gpx_files ADD COLUMN {column_name} {column_type}'))
|
||||
db.session.commit()
|
||||
print(f'Successfully added {column_name} column to gpx_files table')
|
||||
else:
|
||||
print(f'{column_name} column already exists in gpx_files table')
|
||||
|
||||
print('Database schema is up to date')
|
||||
except Exception as e:
|
||||
print(f'Migration error: {e}')
|
||||
db.session.rollback()
|
||||
|
||||
@app.cli.command()
|
||||
def process_gpx_files():
|
||||
"""Process existing GPX files to extract statistics."""
|
||||
from app.utils.gpx_processor import process_gpx_file
|
||||
|
||||
gpx_files = GPXFile.query.all()
|
||||
processed = 0
|
||||
|
||||
for gpx_file in gpx_files:
|
||||
try:
|
||||
if process_gpx_file(gpx_file):
|
||||
processed += 1
|
||||
print(f'Processed: {gpx_file.original_name}')
|
||||
else:
|
||||
print(f'Failed to process: {gpx_file.original_name}')
|
||||
except Exception as e:
|
||||
print(f'Error processing {gpx_file.original_name}: {e}')
|
||||
|
||||
db.session.commit()
|
||||
print(f'Processed {processed}/{len(gpx_files)} GPX files')
|
||||
|
||||
@app.cli.command()
|
||||
def create_admin():
|
||||
"""Create an admin user."""
|
||||
|
||||
Reference in New Issue
Block a user