diff --git a/ConnectStats/sqlite/README.md b/ConnectStats/sqlite/README.md index bb49dd1c..c553446b 100644 --- a/ConnectStats/sqlite/README.md +++ b/ConnectStats/sqlite/README.md @@ -1,5 +1,8 @@ # Update Fields + + + build.py will update fields.db from: - files in cache directory are cached translated fields in multiple languages @@ -9,6 +12,7 @@ build.py will update fields.db from: + ### Connect IQ Field 1. Same steps as above diff --git a/ConnectStats/sqlite/build.py b/ConnectStats/sqlite/build.py index f9353e54..29bfcb35 100755 --- a/ConnectStats/sqlite/build.py +++ b/ConnectStats/sqlite/build.py @@ -21,9 +21,15 @@ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -# -# To rebuild db from legacy: -# ./build.py --init legacy -o out/fields.db build +# +# Regular Usage: +# Add field: +# edit edit/gc_fields_manual.xlsx +# edit edit/fields_order.xlsx +# rerun to update: +# ./build.py -v -b out/fields.db -i latest -o out/fields.json build edit/gc_fields_manual.xlsx edit/fields_order.xlsx +# +# # # To rebuild db adding changes for a file (example here edit/gc_fields_manual.xlsx) # -v : verbose @@ -32,6 +38,11 @@ # -o : save to fields.json # ./build.py -v -b out/fields.db -i latest -o out/fields.json build edit/gc_fields_manual.xlsx # then git diff will show what changed or use 'diff' as a command instead of 'build' +# +# +# To rebuild db from legacy: +# ./build.py --init legacy -o out/fields.db build +# import sqlite3 import argparse @@ -431,7 +442,7 @@ def add_category_and_order(self, info): if no activityType or null applies to all ''' rv = None - debug = (self.key == '__CalcLossElevation') + debug = (self.key == '__CalcRunningEffectiveness') if debug: print( f'add: {info}' ) @@ -766,7 +777,7 @@ def init_latest(self): self.types.verbose = self.verbose self.types.read_from_modern_json( 'download/activity_types_modern.json' ) if self.verbose: - print( 'read {}'.format( base ) ) + print( 'init with latest {}'.format( base ) ) self.types.read_from_db(base) self.fields = Fields(self.types) self.fields.verbose = self.verbose @@ -809,6 +820,8 @@ def init_empty(self): self.categories.verbose = self.verbose def cmd_build(self): + if self.verbose: + print( 'start build' ) for fn in self.args.files: self.process_file( fn ) @@ -863,7 +876,7 @@ def load_from_json(self,jname): def process_file(self,fn): if os.path.exists( fn ): if self.verbose: - print( 'read {}'.format( fn ) ) + print( 'process {}'.format( fn ) ) if fn.endswith( '.db' ) : self.load_db( fn ) elif fn.endswith( '.json' ): diff --git a/ConnectStats/sqlite/edit/gc_fields_manual.xlsx b/ConnectStats/sqlite/edit/gc_fields_manual.xlsx index 91f75270..d113f48a 100644 Binary files a/ConnectStats/sqlite/edit/gc_fields_manual.xlsx and b/ConnectStats/sqlite/edit/gc_fields_manual.xlsx differ diff --git a/ConnectStats/sqlite/out/fields.db b/ConnectStats/sqlite/out/fields.db index 643bc873..36a8bd28 100644 Binary files a/ConnectStats/sqlite/out/fields.db and b/ConnectStats/sqlite/out/fields.db differ diff --git a/ConnectStats/sqlite/out/fields.json b/ConnectStats/sqlite/out/fields.json index 0eb60937..1b50fd12 100644 --- a/ConnectStats/sqlite/out/fields.json +++ b/ConnectStats/sqlite/out/fields.json @@ -2091,6 +2091,10 @@ { "field": "__CalcRotationDevelopment" }, + { + "en": "Running Effectiveness", + "field": "__CalcRunningEffectiveness" + }, { "field": "__CalcStrideLength" }, @@ -2895,6 +2899,11 @@ "field": "__CalcRotationDevelopment", "field_order": 20 }, + { + "category": "running", + "field": "__CalcRunningEffectiveness", + "field_order": 5 + }, { "category": "run", "field": "__CalcStrideLength", @@ -3848,6 +3857,12 @@ "field": "__CalcBestRollingWeightedMeanSpeed", "metric": "kph", "statute": "mph" + }, + { + "activity_type": "running", + "field": "__CalcRunningEffectiveness", + "metric": "dimensionless", + "statute": "dimensionless" } ] } \ No newline at end of file diff --git a/ConnectStats/src/GCActivity+Fields.m b/ConnectStats/src/GCActivity+Fields.m index 146ac59e..0a73cd65 100644 --- a/ConnectStats/src/GCActivity+Fields.m +++ b/ConnectStats/src/GCActivity+Fields.m @@ -74,7 +74,7 @@ -(GCField*)fieldForKey:(NSString*)fieldkey{ @"WeightedMeanVerticalRatio", @"WeightedMeanAirTemperature", @"WeightedMeanLegSpringStiffness", - CALC_METABOLIC_EFFICIENCY, + CALC_RUNNING_EFFECTIVENESS, ], GC_TYPE_CYCLING:@[ @"SumDistance", diff --git a/ConnectStats/src/GCField.m b/ConnectStats/src/GCField.m index daa5b2db..2034cb8a 100644 --- a/ConnectStats/src/GCField.m +++ b/ConnectStats/src/GCField.m @@ -628,7 +628,7 @@ -(NSComparisonResult)compare:(id)other{ @[CALC_ASCENT_SPEED, CALC_MAX_ASCENT_SPEED], @[CALC_DESCENT_SPEED, CALC_MAX_DESCENT_SPEED], @[CALC_VERTICAL_SPEED, CALC_ASCENT_SPEED, CALC_DESCENT_SPEED], - @[CALC_METABOLIC_EFFICIENCY, CALC_RUNNING_EFFECTIVENESS, CALC_EFFICIENCY_FACTOR], + @[ CALC_RUNNING_EFFECTIVENESS, CALC_METABOLIC_EFFICIENCY, CALC_EFFICIENCY_FACTOR], ]; RZRetain(_groups);