Skip to content

Commit

Permalink
Fixing Management Commands
Browse files Browse the repository at this point in the history
  • Loading branch information
vigneshhari committed Jan 27, 2022
1 parent 43dc341 commit 97253b8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
6 changes: 2 additions & 4 deletions .github/workflows/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: Deploy Care
on:
push:
branches:
- '*'
- "*"
tags:
- 'v*'
- "v*"
pull_request:
workflow_dispatch:
env:
Expand All @@ -30,7 +30,6 @@ jobs:
fi
build-dockerhub-staging:
needs: test
environment: Staging
name: Build & Push to Dockerhub
if: github.ref == 'refs/heads/master'
Expand Down Expand Up @@ -68,7 +67,6 @@ jobs:
docker push $IMAGE_ID --all-tags
build-github-staging:
needs: test
environment: Staging
if: github.ref == 'refs/heads/master'
name: Build and push to GitHub
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,18 @@ class Command(BaseCommand):
help = "Populate daily round for consultations"

def handle(self, *args, **options):
consultations = list(PatientConsultation.objects.filter(last_daily_round__isnull=True).values_list("id"))
consultations = list(
PatientConsultation.objects.filter(last_daily_round__isnull=True).values_list("external_id")
)
total_count = len(consultations)
print(f"{total_count} Consultations need to be updated")
i = 0
for consultation_id in consultations:
for consultation_eid in consultations:
if i > 10000 and i % 10000 == 0:
print(f"{i} operations performed")
i = i + 1
PatientConsultation.objects.filter(id=consultation_id[0]).update(
last_daily_round=DailyRound.objects.filter(consultation_id=consultation_id[0])
PatientConsultation.objects.filter(external_id=consultation_eid[0]).update(
last_daily_round=DailyRound.objects.filter(consultation__external_id=consultation_eid[0])
.order_by("-created_date")
.first()
)
Expand Down

0 comments on commit 97253b8

Please sign in to comment.