Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2.10.0 - revival #813

Merged
merged 16 commits into from
Apr 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .github/workflows/check-disk-space.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ jobs:
SSH_PORT: ${{ secrets.SSH_PORT }}
SSH_USER_WEB: ${{ secrets.SSH_USER_WEB }}
steps:
- id: ip
uses: haythem/[email protected]
- name: Setup SSH key
run: |
mkdir -p ~/.ssh/
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/clean-db.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ jobs:
SSH_PORT: ${{ secrets.SSH_PORT }}
SSH_USER_WEB: ${{ secrets.SSH_USER_WEB }}
steps:
- id: ip
uses: haythem/[email protected]
- name: Setup SSH key
run: |
mkdir -p ~/.ssh/
Expand Down
6 changes: 2 additions & 4 deletions .github/workflows/deploy-acceptance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@ jobs:
SSH_USER: ${{ secrets.SSH_USER }}
SSH_USER_WEB: ${{ secrets.SSH_USER_WEB }}
steps:
- uses: actions/checkout@v3
- id: ip
uses: haythem/[email protected]
- uses: actions/checkout@v4
- name: Prepare config file
uses: falnyr/[email protected]
env:
Expand Down Expand Up @@ -61,7 +59,7 @@ jobs:
- name: Unpack release and clean tmp
run: ssh ${SSH_USER_WEB}@${SSH_HOST} -p ${SSH_PORT} "tar -xvf ${TMP_DIR}/release.tar -C ${RELEASE_DIR} && rm ${TMP_DIR}/*"
- name: Create venv and install requirements
run: ssh ${SSH_USER_WEB}@${SSH_HOST} -p ${SSH_PORT} "cd ${RELEASE_DIR} && ~/Python-3.10.0/python -m venv venv && source venv/bin/activate && pip install -r requirements.txt --no-cache-dir"
run: ssh ${SSH_USER_WEB}@${SSH_HOST} -p ${SSH_PORT} "cd ${RELEASE_DIR} && python3 -m venv venv && source venv/bin/activate && pip install -r requirements.txt --no-cache-dir"
- name: Swap releases
run: ssh ${SSH_USER_WEB}@${SSH_HOST} -p ${SSH_PORT} "rm -f ${APP_DIR} && ln -s ${RELEASE_DIR} ${APP_DIR} && find ${RELEASES_DIR} -maxdepth 1 -mindepth 1 -not -path ${RELEASE_DIR} -exec rm -rf {} \;"
- name: Execute migrations
Expand Down
6 changes: 2 additions & 4 deletions .github/workflows/deploy-production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@ jobs:
SSH_USER: ${{ secrets.SSH_USER }}
SSH_USER_WEB: ${{ secrets.SSH_USER_WEB }}
steps:
- uses: actions/checkout@v3
- id: ip
uses: haythem/[email protected]
- uses: actions/checkout@v4
- name: Prepare config file
uses: falnyr/[email protected]
env:
Expand Down Expand Up @@ -59,7 +57,7 @@ jobs:
- name: Unpack release and clean tmp
run: ssh ${SSH_USER_WEB}@${SSH_HOST} -p ${SSH_PORT} "tar -xvf ${TMP_DIR}/release.tar -C ${RELEASE_DIR} && rm ${TMP_DIR}/*"
- name: Create venv and install requirements
run: ssh ${SSH_USER_WEB}@${SSH_HOST} -p ${SSH_PORT} "cd ${RELEASE_DIR} && ~/Python-3.10.0/python -m venv venv && source venv/bin/activate && pip install -r requirements.txt --no-cache-dir"
run: ssh ${SSH_USER_WEB}@${SSH_HOST} -p ${SSH_PORT} "cd ${RELEASE_DIR} && python3 -m venv venv && source venv/bin/activate && pip install -r requirements.txt --no-cache-dir"
- name: Swap releases
run: ssh ${SSH_USER_WEB}@${SSH_HOST} -p ${SSH_PORT} "rm -f ${APP_DIR} && ln -s ${RELEASE_DIR} ${APP_DIR} && find ${RELEASES_DIR} -maxdepth 1 -mindepth 1 -not -path ${RELEASE_DIR} -exec rm -rf {} \;"
- name: Execute migrations
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/post-tweet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ jobs:
SSH_PORT: ${{ secrets.SSH_PORT }}
SSH_USER_WEB: ${{ secrets.SSH_USER_WEB }}
steps:
- id: ip
uses: haythem/[email protected]
- name: Setup SSH key
run: |
mkdir -p ~/.ssh/
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/sync-prd-acc-db.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ jobs:
SSH_PORT: ${{ secrets.SSH_PORT }}
SSH_USER_WEB: ${{ secrets.SSH_USER_WEB }}
steps:
- id: ip
uses: haythem/[email protected]
- name: Setup SSH key
run: |
mkdir -p ~/.ssh/
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ jobs:
SSH_PORT: ${{ secrets.SSH_PORT }}
SSH_USER_WEB: ${{ secrets.SSH_USER_WEB }}
steps:
- id: ip
uses: haythem/[email protected]
- name: Setup SSH key
run: |
mkdir -p ~/.ssh/
Expand Down
23 changes: 21 additions & 2 deletions .github/workflows/update-data-daily.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,38 @@ jobs:
SSH_KEY: ${{ secrets.SSH_KEY }}
SSH_PORT: ${{ secrets.SSH_PORT }}
SSH_USER_WEB: ${{ secrets.SSH_USER_WEB }}
AZURE_CREDENTIALS: ${{ secrets.AZURE_CREDENTIALS }}
AZURE_RESOURCE_GROUP: ${{ secrets.AZURE_RESOURCE_GROUP }}
AZURE_VM_NAME: ${{ secrets.AZURE_VM_NAME }}
steps:
- id: ip
uses: haythem/[email protected]
- name: Setup SSH key
run: |
mkdir -p ~/.ssh/
ssh-keyscan -H ${SSH_HOST} >> ~/.ssh/known_hosts
eval `ssh-agent -s`
echo "${SSH_KEY}" | tr -d '\r' | ssh-add -
echo "SSH_AUTH_SOCK=$SSH_AUTH_SOCK" >> $GITHUB_ENV
- name: Azure login
uses: azure/login@v2
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- name: Azure scale up VM
uses: azure/cli@v2
with:
inlineScript: |
az vm deallocate --resource-group ${AZURE_RESOURCE_GROUP} --name ${AZURE_VM_NAME}
az vm resize --resource-group ${AZURE_RESOURCE_GROUP} --name ${AZURE_VM_NAME} --size Standard_D4s_v3
az vm start --resource-group ${AZURE_RESOURCE_GROUP} --name ${AZURE_VM_NAME}
- name: Execute fetcher
run: ssh ${SSH_USER_WEB}@${SSH_HOST} -p ${SSH_PORT} -o ServerAliveInterval=120 "cd ${APP_DIR} && source venv/bin/activate && flask fetch-data all"
- name: Compute metrics
run: ssh ${SSH_USER_WEB}@${SSH_HOST} -p ${SSH_PORT} -o ServerAliveInterval=120 "cd ${APP_DIR} && source venv/bin/activate && flask compute-metrics all"
- name: Verify data
run: ssh ${SSH_USER_WEB}@${SSH_HOST} -p ${SSH_PORT} "cd ${APP_DIR} && source venv/bin/activate && flask verify-data"
- name: Azure scale down VM
uses: azure/cli@v2
with:
inlineScript: |
az vm deallocate --resource-group ${AZURE_RESOURCE_GROUP} --name ${AZURE_VM_NAME}
az vm resize --resource-group ${AZURE_RESOURCE_GROUP} --name ${AZURE_VM_NAME} --size Standard_B1s
az vm start --resource-group ${AZURE_RESOURCE_GROUP} --name ${AZURE_VM_NAME}
2 changes: 0 additions & 2 deletions .github/workflows/update-data-hourly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ jobs:
SSH_PORT: ${{ secrets.SSH_PORT }}
SSH_USER_WEB: ${{ secrets.SSH_USER_WEB }}
steps:
- id: ip
uses: haythem/[email protected]
- name: Setup SSH key
run: |
mkdir -p ~/.ssh/
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/update-data-monthly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ jobs:
SSH_PORT: ${{ secrets.SSH_PORT }}
SSH_USER_WEB: ${{ secrets.SSH_USER_WEB }}
steps:
- id: ip
uses: haythem/[email protected]
- name: Setup SSH key
run: |
mkdir -p ~/.ssh/
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/update-web.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ jobs:
SSH_PORT: ${{ secrets.SSH_PORT }}
SSH_USER_WEB: ${{ secrets.SSH_USER_WEB }}
steps:
- id: ip
uses: haythem/[email protected]
- name: Setup SSH key
run: |
mkdir -p ~/.ssh/
Expand Down
50 changes: 25 additions & 25 deletions app/etl/center_metrics_etl.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ def _compute_registrations(self):
"""Computes metrics based on registrations dataset for each vaccination center."""
registrations = db.session.query(
OckovaciMisto.id, func.coalesce(func.sum(OckovaniRegistrace.pocet), 0).label('registrace_celkem'),
func.coalesce(func.sum(case([((OckovaniRegistrace.rezervace == False) & (OckovaniRegistrace.ockovani < 1), OckovaniRegistrace.pocet)], else_=0)), 0).label("registrace_fronta"),
func.coalesce(func.sum(case([((OckovaniRegistrace.pred_zavorou == True) & (OckovaniRegistrace.ockovani < 1), OckovaniRegistrace.pocet)], else_=0)), 0).label("registrace_pred_zavorou"),
func.coalesce(func.sum(case([(OckovaniRegistrace.datum_rezervace >= self._date - timedelta(7), OckovaniRegistrace.pocet)], else_=0)) / 7.0, 0).label('registrace_rezervace_prumer')
func.coalesce(func.sum(case(((OckovaniRegistrace.rezervace == False) & (OckovaniRegistrace.ockovani < 1), OckovaniRegistrace.pocet), else_=0)), 0).label("registrace_fronta"),
func.coalesce(func.sum(case(((OckovaniRegistrace.pred_zavorou == True) & (OckovaniRegistrace.ockovani < 1), OckovaniRegistrace.pocet), else_=0)), 0).label("registrace_pred_zavorou"),
func.coalesce(func.sum(case((OckovaniRegistrace.datum_rezervace >= self._date - timedelta(7), OckovaniRegistrace.pocet), else_=0)) / 7.0, 0).label('registrace_rezervace_prumer')
).outerjoin(OckovaniRegistrace, and_(OckovaciMisto.id == OckovaniRegistrace.ockovaci_misto_id, OckovaniRegistrace.import_id == self._import_id)) \
.group_by(OckovaciMisto.id) \
.all()
Expand All @@ -68,15 +68,15 @@ def _compute_reservations(self):
reservations = db.session.query(
OckovaciMisto.id,
func.coalesce(func.sum(OckovaniRezervace.maximalni_kapacita - OckovaniRezervace.volna_kapacita), 0).label('rezervace_celkem'),
func.coalesce(func.sum(case([(OckovaniRezervace.datum >= self._date, OckovaniRezervace.maximalni_kapacita - OckovaniRezervace.volna_kapacita)], else_=0)), 0).label("rezervace_cekajici"),
func.coalesce(func.sum(case([(and_(OckovaniRezervace.datum >= self._date, OckovaniRezervace.kalendar_ockovani == 'V1'), OckovaniRezervace.maximalni_kapacita - OckovaniRezervace.volna_kapacita)], else_=0)), 0).label("rezervace_cekajici_1"),
func.coalesce(func.sum(case([(and_(OckovaniRezervace.datum >= self._date, OckovaniRezervace.kalendar_ockovani == 'V2'), OckovaniRezervace.maximalni_kapacita - OckovaniRezervace.volna_kapacita)], else_=0)), 0).label("rezervace_cekajici_2"),
func.coalesce(func.sum(case([(and_(OckovaniRezervace.datum >= self._date, OckovaniRezervace.kalendar_ockovani == 'VN'), OckovaniRezervace.maximalni_kapacita - OckovaniRezervace.volna_kapacita)], else_=0)), 0).label("rezervace_cekajici_3"),
func.coalesce(func.sum(case([(OckovaniRezervace.datum == self._date, OckovaniRezervace.maximalni_kapacita)], else_=0)), 0).label("rezervace_kapacita"),
func.coalesce(func.sum(case([(and_(OckovaniRezervace.datum == self._date, OckovaniRezervace.kalendar_ockovani == 'V1'), OckovaniRezervace.maximalni_kapacita)], else_=0)), 0).label("rezervace_kapacita_1"),
func.coalesce(func.sum(case([(and_(OckovaniRezervace.datum == self._date, OckovaniRezervace.kalendar_ockovani == 'V2'), OckovaniRezervace.maximalni_kapacita)], else_=0)), 0).label("rezervace_kapacita_2"),
func.coalesce(func.sum(case([(and_(OckovaniRezervace.datum == self._date, OckovaniRezervace.kalendar_ockovani == 'VN'), OckovaniRezervace.maximalni_kapacita)], else_=0)), 0).label("rezervace_kapacita_3"),
func.min(case([(and_(OckovaniRezervace.datum >= self._date, OckovaniRezervace.kalendar_ockovani == 'V1', OckovaniRezervace.volna_kapacita > 0), OckovaniRezervace.datum)], else_=None)).label("rezervace_nejblizsi_volno")
func.coalesce(func.sum(case((OckovaniRezervace.datum >= self._date, OckovaniRezervace.maximalni_kapacita - OckovaniRezervace.volna_kapacita), else_=0)), 0).label("rezervace_cekajici"),
func.coalesce(func.sum(case((and_(OckovaniRezervace.datum >= self._date, OckovaniRezervace.kalendar_ockovani == 'V1'), OckovaniRezervace.maximalni_kapacita - OckovaniRezervace.volna_kapacita), else_=0)), 0).label("rezervace_cekajici_1"),
func.coalesce(func.sum(case((and_(OckovaniRezervace.datum >= self._date, OckovaniRezervace.kalendar_ockovani == 'V2'), OckovaniRezervace.maximalni_kapacita - OckovaniRezervace.volna_kapacita), else_=0)), 0).label("rezervace_cekajici_2"),
func.coalesce(func.sum(case((and_(OckovaniRezervace.datum >= self._date, OckovaniRezervace.kalendar_ockovani == 'VN'), OckovaniRezervace.maximalni_kapacita - OckovaniRezervace.volna_kapacita), else_=0)), 0).label("rezervace_cekajici_3"),
func.coalesce(func.sum(case((OckovaniRezervace.datum == self._date, OckovaniRezervace.maximalni_kapacita), else_=0)), 0).label("rezervace_kapacita"),
func.coalesce(func.sum(case((and_(OckovaniRezervace.datum == self._date, OckovaniRezervace.kalendar_ockovani == 'V1'), OckovaniRezervace.maximalni_kapacita), else_=0)), 0).label("rezervace_kapacita_1"),
func.coalesce(func.sum(case((and_(OckovaniRezervace.datum == self._date, OckovaniRezervace.kalendar_ockovani == 'V2'), OckovaniRezervace.maximalni_kapacita), else_=0)), 0).label("rezervace_kapacita_2"),
func.coalesce(func.sum(case((and_(OckovaniRezervace.datum == self._date, OckovaniRezervace.kalendar_ockovani == 'VN'), OckovaniRezervace.maximalni_kapacita), else_=0)), 0).label("rezervace_kapacita_3"),
func.min(case((and_(OckovaniRezervace.datum >= self._date, OckovaniRezervace.kalendar_ockovani == 'V1', OckovaniRezervace.volna_kapacita > 0), OckovaniRezervace.datum), else_=None)).label("rezervace_nejblizsi_volno")
).outerjoin(OckovaniRezervace, OckovaciMisto.id == OckovaniRezervace.ockovaci_misto_id) \
.group_by(OckovaciMisto.id) \
.all()
Expand All @@ -102,10 +102,10 @@ def _compute_reservations(self):
def _compute_vaccinated(self):
"""Computes metrics based on vaccinated people dataset for each vaccination center."""
vaccinated = db.session.query(OckovaciMisto.id, func.coalesce(func.sum(OckovaniLide.pocet), 0).label('ockovani_pocet_davek'),
func.coalesce(func.sum(case([(OckovaniLide.poradi_davky == 1, OckovaniLide.pocet)], else_=0)), 0).label('ockovani_pocet_castecne'),
func.coalesce(func.sum(case([(OckovaniLide.poradi_davky == Vakcina.davky, OckovaniLide.pocet)], else_=0)), 0).label('ockovani_pocet_plne'),
func.coalesce(func.sum(case([(OckovaniLide.poradi_davky == 3, OckovaniLide.pocet)], else_=0)), 0).label('ockovani_pocet_3'),
func.coalesce(func.sum(case([(OckovaniLide.poradi_davky == 4, OckovaniLide.pocet)], else_=0)), 0).label('ockovani_pocet_4')) \
func.coalesce(func.sum(case((OckovaniLide.poradi_davky == 1, OckovaniLide.pocet), else_=0)), 0).label('ockovani_pocet_castecne'),
func.coalesce(func.sum(case((OckovaniLide.poradi_davky == Vakcina.davky, OckovaniLide.pocet), else_=0)), 0).label('ockovani_pocet_plne'),
func.coalesce(func.sum(case((OckovaniLide.poradi_davky == 3, OckovaniLide.pocet), else_=0)), 0).label('ockovani_pocet_3'),
func.coalesce(func.sum(case((OckovaniLide.poradi_davky == 4, OckovaniLide.pocet), else_=0)), 0).label('ockovani_pocet_4')) \
.outerjoin(OckovaniLide, and_(OckovaciMisto.nrpzs_kod == OckovaniLide.zarizeni_kod, OckovaniLide.datum < self._date)) \
.join(Vakcina, Vakcina.vakcina == OckovaniLide.vakcina) \
.filter(or_(and_(OckovaciMisto.status == True, OckovaciMisto.nrpzs_kod.in_(queries.unique_nrpzs_active_subquery())),
Expand All @@ -130,9 +130,9 @@ def _compute_distributed(self):
"""Computes metrics based on distributed vaccines dataset for each vaccination center."""
distributed = db.session.query(
OckovaciMisto.id, (
func.coalesce(func.sum(case([(and_(OckovaciMisto.id == OckovaniDistribuce.ockovaci_misto_id, OckovaniDistribuce.akce == 'Příjem'), OckovaniDistribuce.pocet_davek)], else_=0)), 0)
+ func.coalesce(func.sum(case([(and_(OckovaciMisto.id == OckovaniDistribuce.cilove_ockovaci_misto_id, OckovaniDistribuce.akce == 'Výdej'), OckovaniDistribuce.pocet_davek)], else_=0)), 0)
- func.coalesce(func.sum(case([(and_(OckovaciMisto.id == OckovaniDistribuce.ockovaci_misto_id, OckovaniDistribuce.akce == 'Výdej'), OckovaniDistribuce.pocet_davek)], else_=0)), 0))
func.coalesce(func.sum(case((and_(OckovaciMisto.id == OckovaniDistribuce.ockovaci_misto_id, OckovaniDistribuce.akce == 'Příjem'), OckovaniDistribuce.pocet_davek), else_=0)), 0)
+ func.coalesce(func.sum(case((and_(OckovaciMisto.id == OckovaniDistribuce.cilove_ockovaci_misto_id, OckovaniDistribuce.akce == 'Výdej'), OckovaniDistribuce.pocet_davek), else_=0)), 0)
- func.coalesce(func.sum(case((and_(OckovaciMisto.id == OckovaniDistribuce.ockovaci_misto_id, OckovaniDistribuce.akce == 'Výdej'), OckovaniDistribuce.pocet_davek), else_=0)), 0))
.label('vakciny_prijate_pocet')
).outerjoin(OckovaniDistribuce, and_(
or_(OckovaciMisto.id == OckovaniDistribuce.ockovaci_misto_id, OckovaciMisto.id == OckovaniDistribuce.cilove_ockovaci_misto_id),
Expand Down Expand Up @@ -230,8 +230,8 @@ def _compute_derived(self):

success_ratio_7 = db.session.query(
OckovaciMisto.id,
(1.0 * func.coalesce(func.sum(case([(OckovaniRegistrace.rezervace == True, OckovaniRegistrace.pocet)], else_=0)), 0)
/ case([(func.sum(OckovaniRegistrace.pocet) == 0, None)], else_=func.sum(OckovaniRegistrace.pocet))).label('registrace_tydenni_uspesnost')
(1.0 * func.coalesce(func.sum(case((OckovaniRegistrace.rezervace == True, OckovaniRegistrace.pocet), else_=0)), 0)
/ case((func.sum(OckovaniRegistrace.pocet) == 0, None), else_=func.sum(OckovaniRegistrace.pocet))).label('registrace_tydenni_uspesnost')
).join(OckovaniRegistrace, OckovaciMisto.id == OckovaniRegistrace.ockovaci_misto_id) \
.filter(OckovaniRegistrace.import_id == self._import_id) \
.filter(OckovaniRegistrace.datum >= self._date - timedelta(7)) \
Expand All @@ -247,8 +247,8 @@ def _compute_derived(self):

success_ratio_14 = db.session.query(
OckovaciMisto.id,
(1.0 * func.coalesce(func.sum(case([(OckovaniRegistrace.rezervace == True, OckovaniRegistrace.pocet)], else_=0)), 0)
/ case([(func.sum(OckovaniRegistrace.pocet) == 0, None)], else_=func.sum(OckovaniRegistrace.pocet))).label('registrace_14denni_uspesnost')
(1.0 * func.coalesce(func.sum(case((OckovaniRegistrace.rezervace == True, OckovaniRegistrace.pocet), else_=0)), 0)
/ case((func.sum(OckovaniRegistrace.pocet) == 0, None), else_=func.sum(OckovaniRegistrace.pocet))).label('registrace_14denni_uspesnost')
).join(OckovaniRegistrace, OckovaciMisto.id == OckovaniRegistrace.ockovaci_misto_id) \
.filter(OckovaniRegistrace.import_id == self._import_id) \
.filter(OckovaniRegistrace.datum >= self._date - timedelta(14)) \
Expand All @@ -264,8 +264,8 @@ def _compute_derived(self):

success_ratio_30 = db.session.query(
OckovaciMisto.id,
(1.0 * func.coalesce(func.sum(case([(OckovaniRegistrace.rezervace == True, OckovaniRegistrace.pocet)], else_=0)), 0)
/ case([(func.sum(OckovaniRegistrace.pocet) == 0, None)], else_=func.sum(OckovaniRegistrace.pocet))).label('registrace_30denni_uspesnost')
(1.0 * func.coalesce(func.sum(case((OckovaniRegistrace.rezervace == True, OckovaniRegistrace.pocet), else_=0)), 0)
/ case((func.sum(OckovaniRegistrace.pocet) == 0, None), else_=func.sum(OckovaniRegistrace.pocet))).label('registrace_30denni_uspesnost')
).join(OckovaniRegistrace, OckovaciMisto.id == OckovaniRegistrace.ockovaci_misto_id) \
.filter(OckovaniRegistrace.import_id == self._import_id) \
.filter(OckovaniRegistrace.datum >= self._date - timedelta(30)) \
Expand Down
Loading
Loading