parent
c4877046ab
commit
e78d014ed1
@ -1,4 +1,4 @@
|
||||
[run]
|
||||
omit =
|
||||
fittrackee_api/venv/*
|
||||
fittrackee_api/.venv/*
|
||||
fittrackee_api/fittrackee_api/tests/*
|
||||
|
@ -1,6 +1,7 @@
|
||||
export REACT_APP_API_URL = http://$(HOST):$(API_PORT)
|
||||
export REACT_APP_THUNDERFOREST_API_KEY=
|
||||
export WEATHER_API=
|
||||
export REACT_APP_GPX_LIMIT_IMPORT=10
|
||||
|
||||
# for dev env
|
||||
export CODACY_PROJECT_TOKEN=
|
||||
|
@ -6,7 +6,7 @@ from datetime import datetime, timedelta
|
||||
|
||||
import gpxpy.gpx
|
||||
import pytz
|
||||
from fittrackee_api import db
|
||||
from fittrackee_api import appLog, db
|
||||
from flask import current_app
|
||||
from sqlalchemy import exc
|
||||
from staticmap import Line, StaticMap
|
||||
@ -368,10 +368,19 @@ def process_zip_archive(common_params, extract_dir):
|
||||
zip_ref.extractall(extract_dir)
|
||||
|
||||
new_activities = []
|
||||
if os.getenv('REACT_APP_GPX_LIMIT_IMPORT').isdigit():
|
||||
gpx_files_limit = int(os.getenv('REACT_APP_GPX_LIMIT_IMPORT'))
|
||||
else:
|
||||
gpx_files_limit = 10
|
||||
appLog.error('GPX limit not configured, set to 10.')
|
||||
gpx_files_ok = 0
|
||||
|
||||
for gpx_file in os.listdir(extract_dir):
|
||||
if ('.' in gpx_file and gpx_file.rsplit('.', 1)[1].lower()
|
||||
in current_app.config.get('ACTIVITY_ALLOWED_EXTENSIONS')):
|
||||
gpx_files_ok += 1
|
||||
if gpx_files_ok > gpx_files_limit:
|
||||
break
|
||||
file_path = os.path.join(extract_dir, gpx_file)
|
||||
params = common_params
|
||||
params['file_path'] = file_path
|
||||
|
@ -4,6 +4,7 @@ import { connect } from 'react-redux'
|
||||
import { setLoading } from '../../../actions/index'
|
||||
import { addActivity, editActivity } from '../../../actions/activities'
|
||||
import { history } from '../../../index'
|
||||
import { gpxLimit } from '../../../utils'
|
||||
|
||||
|
||||
function FormWithGpx (props) {
|
||||
@ -52,7 +53,8 @@ function FormWithGpx (props) {
|
||||
<div className="form-group">
|
||||
<label>
|
||||
<strong>gpx</strong> file or <strong>zip</strong>{' '}
|
||||
file containing <strong>gpx</strong> (no folder inside):
|
||||
file containing <strong>gpx</strong> (no folder inside, {
|
||||
gpxLimit} files max):
|
||||
<input
|
||||
accept=".gpx, .zip"
|
||||
className="form-control input-lg"
|
||||
|
@ -6,6 +6,7 @@ export const apiUrl = `${process.env.REACT_APP_API_URL}/api/`
|
||||
export const thunderforestApiKey = `${
|
||||
process.env.REACT_APP_THUNDERFOREST_API_KEY
|
||||
}`
|
||||
export const gpxLimit = `${process.env.REACT_APP_GPX_LIMIT_IMPORT}`
|
||||
export const activityColors = [
|
||||
'#55a8a3',
|
||||
'#98C3A9',
|
||||
|
@ -1,2 +1,2 @@
|
||||
[pytest]
|
||||
norecursedirs = fittrackee_api/venv
|
||||
norecursedirs = fittrackee_api/.venv
|
||||
|
Loading…
Reference in New Issue
Block a user