diff --git a/app.py b/app.py index 644ab73..f71753d 100644 --- a/app.py +++ b/app.py @@ -883,41 +883,6 @@ def update_entry(entry_id): }) -@app.route('/history') -@login_required -def history(): - # Get project filter from query parameters - project_filter = request.args.get('project_id') - - # Base query for user's time entries - query = TimeEntry.query.filter_by(user_id=g.user.id) - - # Apply project filter if specified - if project_filter: - if project_filter == 'none': - # Show entries with no project assigned - query = query.filter(TimeEntry.project_id.is_(None)) - else: - # Show entries for specific project - try: - project_id = int(project_filter) - query = query.filter_by(project_id=project_id) - except ValueError: - # Invalid project ID, ignore filter - pass - - # Get filtered entries ordered by most recent first - all_entries = query.order_by(TimeEntry.arrival_time.desc()).all() - - # Get available projects for the filter dropdown - available_projects = [] - all_projects = Project.query.filter_by(is_active=True).all() - for project in all_projects: - if project.is_user_allowed(g.user): - available_projects.append(project) - - return render_template('history.html', title='Time Entry History', - entries=all_entries, available_projects=available_projects) def calculate_work_duration(arrival_time, departure_time, total_break_duration): """ diff --git a/templates/history.html b/templates/history.html deleted file mode 100644 index 3633e4a..0000000 --- a/templates/history.html +++ /dev/null @@ -1,342 +0,0 @@ -{% extends "layout.html" %} - -{% block content %} -
| Date | -Project | -Arrival | -Departure | -Work Duration | -Break Duration | -Notes | -Actions | -
|---|---|---|---|---|---|---|---|
| {{ entry.arrival_time.strftime('%Y-%m-%d') }} | -- {% if entry.project %} - {{ entry.project.code }} - {{ entry.project.name }} - {% else %} - No project - {% endif %} - | -{{ entry.arrival_time.strftime('%H:%M:%S') }} | -{{ entry.departure_time.strftime('%H:%M:%S') if entry.departure_time else 'Active' }} | -{{ '%d:%02d:%02d'|format(entry.duration//3600, (entry.duration%3600)//60, entry.duration%60) if entry.duration is not none else 'In progress' }} | -{{ '%d:%02d:%02d'|format(entry.total_break_duration//3600, (entry.total_break_duration%3600)//60, entry.total_break_duration%60) if entry.total_break_duration is not none else '00:00:00' }} | -- {% if entry.notes %} - {{ entry.notes[:50] }}{% if entry.notes|length > 50 %}...{% endif %} - {% else %} - - - {% endif %} - | -- - - | -
No time entries recorded yet.
- {% endif %} -