Skip to content

Commit

Permalink
Merge pull request #508 from Turbo87/fix
Browse files Browse the repository at this point in the history
views/flight: Fix broken "g.current_user" reference
  • Loading branch information
Turbo87 authored Oct 25, 2016
2 parents ab30d94 + 6e4e1c4 commit 503e367
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions skylines/frontend/views/flight.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import math
from datetime import datetime

from flask import Blueprint, request, abort, current_app, jsonify, g, make_response
from flask import Blueprint, request, abort, current_app, jsonify, make_response

from sqlalchemy import literal_column, and_
from sqlalchemy.orm import undefer_group, contains_eager
Expand Down Expand Up @@ -45,9 +45,11 @@ def _reanalyse_if_needed(flight):


def _patch_query(q):
current_user = User.get(request.user_id) if request.user_id else None

return q.join(Flight.igc_file) \
.options(contains_eager(Flight.igc_file)) \
.filter(Flight.is_viewable(g.current_user))
.filter(Flight.is_viewable(current_user))


def _get_flight_path(flight, threshold=0.001, max_points=3000):
Expand Down

0 comments on commit 503e367

Please sign in to comment.