forked from no13bus/baymax
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
147 changed files
with
1,863 additions
and
11,269 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,3 +23,6 @@ uploads | |
openid | ||
|
||
env | ||
|
||
.idea | ||
.idea/*.* |
Large diffs are not rendered by default.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
0
fbone/__init__.py → baymax/__init__.py
100755 → 100644
File renamed without changes.
0
fbone/admin/__init__.py → baymax/admin/__init__.py
100755 → 100644
File renamed without changes.
0
fbone/admin/forms.py → baymax/admin/forms.py
100755 → 100644
File renamed without changes.
0
fbone/admin/views.py → baymax/admin/views.py
100755 → 100644
File renamed without changes.
0
fbone/api/__init__.py → baymax/api/__init__.py
100755 → 100644
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
from flask import Blueprint, jsonify | ||
from flask.ext.login import current_user, login_required | ||
from ..user import User | ||
from ..monitor import MonitorValue | ||
|
||
|
||
api = Blueprint('api', __name__, url_prefix='/api') | ||
|
||
@api.route('/<monitor_type>', methods=['GET']) | ||
@login_required | ||
def calories_out(monitor_type): | ||
res = [] | ||
user_id = current_user.id | ||
mv = MonitorValue.query.filter_by(user_id=user_id, datatype=monitor_type).order_by('recode_date desc').limit(7).all() | ||
if not mv: | ||
return jsonify(result=[]) | ||
for one_mv in mv[::-1]: | ||
res.append([one_mv.recode_date.strftime('%Y-%m-%d'), one_mv.value]) | ||
return jsonify(result=res) | ||
|
||
@api.route('/user/<username>/<monitor_type>', methods=['GET']) | ||
def api_data(username, monitor_type): | ||
res = [] | ||
user = User.query.filter_by(name=username).first() | ||
user_id = user.id | ||
mv = MonitorValue.query.filter_by(user_id=user_id, datatype=monitor_type).order_by('recode_date desc').limit(7).all() | ||
if not mv: | ||
return jsonify(result=[]) | ||
for one_mv in mv[::-1]: | ||
res.append([one_mv.recode_date.strftime('%Y-%m-%d'), one_mv.value]) | ||
return jsonify(result=res) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.