from django.core.management.base import BaseCommand, CommandError
from sdap.studies.models import ExpressionStudy, ExpressionData
from django.utils.timezone import now
from datetime import timedelta
import sys

class Command(BaseCommand):
    help = 'Was a study modified in the last x days?'

    def add_arguments(self, parser):
        parser.add_argument(
            "--days",
            default=7,
            type=int,
            help="Number of days elapsed : default 7"
        )

    def handle(self, *args, **options):
        if not ExpressionStudy.objects.filter(updated_at__gte = now()-timedelta(days=options['days'])).exists() or ExpressionData.objects.filter(created_at__gte = now()-timedelta(days=options['days'])):
            print('False')
            sys.exit(1)
        print('True')

b21c731dc88b76fce198c70afb01990614c7002b
<mask token>


class Command(BaseCommand):
    <mask token>

    def add_arguments(self, parser):
        parser.add_argument('--days', default=7, type=int, help=
            'Number of days elapsed : default 7')
    <mask token>

<mask token>


class Command(BaseCommand):
    <mask token>

    def add_arguments(self, parser):
        parser.add_argument('--days', default=7, type=int, help=
            'Number of days elapsed : default 7')

    def handle(self, *args, **options):
        if not ExpressionStudy.objects.filter(updated_at__gte=now() -
            timedelta(days=options['days'])).exists(
            ) or ExpressionData.objects.filter(created_at__gte=now() -
            timedelta(days=options['days'])):
            print('False')
            sys.exit(1)
        print('True')

<mask token>


class Command(BaseCommand):
    help = 'Was a study modified in the last x days?'

    def add_arguments(self, parser):
        parser.add_argument('--days', default=7, type=int, help=
            'Number of days elapsed : default 7')

    def handle(self, *args, **options):
        if not ExpressionStudy.objects.filter(updated_at__gte=now() -
            timedelta(days=options['days'])).exists(
            ) or ExpressionData.objects.filter(created_at__gte=now() -
            timedelta(days=options['days'])):
            print('False')
            sys.exit(1)
        print('True')

from django.core.management.base import BaseCommand, CommandError
from sdap.studies.models import ExpressionStudy, ExpressionData
from django.utils.timezone import now
from datetime import timedelta
import sys


class Command(BaseCommand):
    help = 'Was a study modified in the last x days?'

    def add_arguments(self, parser):
        parser.add_argument('--days', default=7, type=int, help=
            'Number of days elapsed : default 7')

    def handle(self, *args, **options):
        if not ExpressionStudy.objects.filter(updated_at__gte=now() -
            timedelta(days=options['days'])).exists(
            ) or ExpressionData.objects.filter(created_at__gte=now() -
            timedelta(days=options['days'])):
            print('False')
            sys.exit(1)
        print('True')

from django.core.management.base import BaseCommand, CommandError
from sdap.studies.models import ExpressionStudy, ExpressionData
from django.utils.timezone import now
from datetime import timedelta
import sys

class Command(BaseCommand):
    help = 'Was a study modified in the last x days?'

    def add_arguments(self, parser):
        parser.add_argument(
            "--days",
            default=7,
            type=int,
            help="Number of days elapsed : default 7"
        )

    def handle(self, *args, **options):
        if not ExpressionStudy.objects.filter(updated_at__gte = now()-timedelta(days=options['days'])).exists() or ExpressionData.objects.filter(created_at__gte = now()-timedelta(days=options['days'])):
            print('False')
            sys.exit(1)
        print('True')
