forked from yihong0618/running_page
-
Notifications
You must be signed in to change notification settings - Fork 100
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'refs/heads/feat-elevation-gain'
# Conflicts: # .github/workflows/run_data_sync.yml # README-CN.md # README.md # run_page/generator/__init__.py # run_page/generator/db.py # src/components/RunTable/RunRow.tsx # src/components/RunTable/style.module.css # src/components/YearStat/index.tsx
- Loading branch information
Showing
19 changed files
with
192 additions
and
38 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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
from generator.db import init_db, Activity | ||
from config import SQL_FILE | ||
import sqlalchemy | ||
from sqlalchemy import text | ||
from config import GPX_FOLDER, JSON_FILE, SQL_FILE | ||
from utils import make_activities_file | ||
|
||
|
||
def add_column_elevation_gain(session): | ||
# check if column elevation_gain is already added | ||
# if not add it to the db | ||
try: | ||
session.query(Activity).first() | ||
print("column elevation_gain already added, skipping") | ||
except sqlalchemy.exc.OperationalError: | ||
sql_statement = 'alter TABLE "activities" add column elevation_gain Float after average_heartrate' | ||
session.execute(text(sql_statement)) | ||
print("column elevation_gain added successfully") | ||
|
||
|
||
if __name__ == "__main__": | ||
session = init_db(SQL_FILE) | ||
add_column_elevation_gain(session) | ||
# regenerate activities | ||
make_activities_file(SQL_FILE, GPX_FOLDER, JSON_FILE) |
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
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
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.