fix(sync): состав сетов ездит на сервер — колонка set_groups, upsert, bootstrap; счётчик синка считает и обновления
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
# backend/routers/bootstrap.py
|
||||
|
||||
import json
|
||||
|
||||
from fastapi import APIRouter, Depends, HTTPException
|
||||
from sqlalchemy.orm import Session, joinedload
|
||||
from sqlalchemy import or_
|
||||
@@ -65,6 +67,12 @@ def get_bootstrap_data(
|
||||
def serialize_workout(w):
|
||||
wt_name = w.workout_type.name if w.workout_type else ""
|
||||
client_name = w.client.full_name if w.client else None
|
||||
try:
|
||||
set_groups = json.loads(w.set_groups or "[]")
|
||||
if not isinstance(set_groups, list):
|
||||
set_groups = []
|
||||
except Exception:
|
||||
set_groups = []
|
||||
|
||||
return {
|
||||
"id": w.id,
|
||||
@@ -75,6 +83,7 @@ def get_bootstrap_data(
|
||||
"start_time": w.start_time,
|
||||
"end_time": w.end_time,
|
||||
"notes": w.notes,
|
||||
"set_groups": set_groups,
|
||||
"synced": w.synced,
|
||||
"created_at": w.created_at,
|
||||
"updated_at": w.updated_at,
|
||||
|
||||
Reference in New Issue
Block a user