forked from breatheco-de/apiv2
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'development' of https://github.com/breatheco-de/apiv2 i…
…nto development
- Loading branch information
Showing
30 changed files
with
2,103 additions
and
646 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,8 @@ | ||
from django.apps import AppConfig # noqa: F401 | ||
|
||
|
||
class AssessmentConfig(AppConfig): | ||
name = 'breathecode.assessment' | ||
|
||
def ready(self): | ||
from . import receivers # noqa: F401 |
20 changes: 20 additions & 0 deletions
20
breathecode/assessment/management/commands/close_open_user_assessments.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import os | ||
from django.core.management.base import BaseCommand, CommandError | ||
from django.contrib.auth.models import User | ||
from django.utils import timezone | ||
from breathecode.admissions.models import CohortUser | ||
from django.db.models import Count | ||
|
||
HOST = os.environ.get('OLD_BREATHECODE_API') | ||
DATETIME_FORMAT = '%Y-%m-%d' | ||
|
||
|
||
class Command(BaseCommand): | ||
help = 'Close user assessments and totalize scores' | ||
|
||
def handle(self, *args, **options): | ||
|
||
unfinished_ua = UserAssessment.objects.filter(finished_at__isnull=True, status='SENT') | ||
total = unfinished_ua.count() | ||
unfinished_ua.update(status='ERROR', status_text='Unfinished user assessment') | ||
self.stdout.write(self.style.SUCCESS(f'{total} user assessments automatically closed with error')) |
Oops, something went wrong.