Bump version in constants.js

This commit is contained in:
Lucas Verney 2018-10-25 11:13:35 +02:00
parent 04ff61dbdd
commit 34e0fec016
2 changed files with 23 additions and 2 deletions

View File

@ -19,6 +19,7 @@ from shapely.geometry import Point, shape
from shapely.ops import transform
from server.models import db, Report
from server.tools import UTC_now
level = logging.WARN
RAISE_ON_EXCEPT = False
@ -28,6 +29,9 @@ if 'RAISE_ON_EXCEPT' in os.environ:
RAISE_ON_EXCEPT = True
logging.basicConfig(level=level)
# Same as in src/constants.js
REPORT_DOWNVOTES_THRESHOLD = 1
def preprocess_lille(data):
for item in data:
@ -396,7 +400,24 @@ project = partial(
def process_opendata(name, data, report_type=REPORT_TYPE):
# Coordinates of current reports in db, as shapely Points in Lambert93
current_reports_points = []
for report in Report.select().where(Report.type == REPORT_TYPE):
active_reports_from_db = Report.select().where(
# Load reports from db of the current type
(Report.type == REPORT_TYPE) &
(
# Either with an expiration_datetime in the future
(
(Report.expiration_datetime != None) &
(Report.expiration_datetime > UTC_now())
) |
# Or without expiration_datetime but which are still active (shown
# on the map)
(
(Report.expiration_datetime == None) &
(Report.downvotes < REPORT_DOWNVOTES_THRESHOLD)
)
)
)
for report in active_reports_from_db:
current_reports_points.append(
transform(project, Point(report.lng, report.lat))
)

View File

@ -11,7 +11,7 @@ import miscIcon from '@/assets/misc.svg';
import obstacleIcon from '@/assets/obstacle.svg';
import potholeIcon from '@/assets/pothole.svg';
export const VERSION = '0.2';
export const VERSION = '0.3';
export const NORMAL_ICON_SCALE = 0.625;
export const LARGE_ICON_SCALE = 1.0;