@runnerpro/backend 1.10.0 → 1.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"saveWorkoutAplication.d.ts","sourceRoot":"","sources":["../../../../src/workout/saveWorkoutAplication.ts"],"names":[],"mappings":"AAUA,QAAA,MAAM,qBAAqB;;;;;;;;;;;;;;6BAwD1B,CAAC;AAuCF,OAAO,EAAE,qBAAqB,EAAE,CAAC"}
1
+ {"version":3,"file":"saveWorkoutAplication.d.ts","sourceRoot":"","sources":["../../../../src/workout/saveWorkoutAplication.ts"],"names":[],"mappings":"AAUA,QAAA,MAAM,qBAAqB;;;;;;;;;;;;;;6BAwD1B,CAAC;AA8CF,OAAO,EAAE,qBAAqB,EAAE,CAAC"}
@@ -52,14 +52,21 @@ const saveWorkoutAplication = ({ date, type, title, description, distance, durat
52
52
  yield (0, estructuraWorkout_1.saveDoneStructuraWorkout)(exist.id, null, exist.type);
53
53
  }
54
54
  yield (0, db_1.query)(`
55
- UPDATE [WORKOUT] SET [DISTANCE] = ?, [DURATION] = ?, [POTENCIA] = ?, [DESNIVEL] = ?, [TIPO APLICATION] = ?, [ID APLICATION] = ?, [DONE] = TRUE, [RAW] = ?
55
+ UPDATE [WORKOUT] SET [DISTANCE] = ?, [DURATION] = ?, [POTENCIA] = ?, [DESNIVEL] = ?, [POLYLINE] = ?, [TIPO APLICATION] = ?, [ID APLICATION] = ?, [DONE] = TRUE, [RAW] = ?
56
56
  WHERE [ID] = ?
57
- `, [distance, duration, power, desnivel, aplicationType, aplicationId, JSON.stringify(data), idWorkout]);
57
+ `, [distance, duration, power, desnivel, getPolyline(polyline), aplicationType, aplicationId, JSON.stringify(data), idWorkout]);
58
58
  yield saveMap(idWorkout, polyline);
59
59
  saveShareWorkoutImage(idWorkout, type);
60
60
  return idWorkout;
61
61
  });
62
62
  exports.saveWorkoutAplication = saveWorkoutAplication;
63
+ const getPolyline = (activity) => {
64
+ var _a, _b;
65
+ if (!((_a = activity === null || activity === void 0 ? void 0 : activity.map) === null || _a === void 0 ? void 0 : _a.polyline))
66
+ return null;
67
+ const polyline = ((_b = activity.map) === null || _b === void 0 ? void 0 : _b.polyline.length) > 5000 ? activity.map.summary_polyline : activity.map.polyline;
68
+ return encodeURIComponent(polyline);
69
+ };
63
70
  const saveMap = (idWorkout, polyline) => __awaiter(void 0, void 0, void 0, function* () {
64
71
  if (!polyline)
65
72
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@runnerpro/backend",
3
- "version": "1.10.0",
3
+ "version": "1.10.1",
4
4
  "description": "A collection of common backend functions",
5
5
  "exports": {
6
6
  ".": "./lib/cjs/index.js"