Beispiel #1
0
def create_exclusions(days, occurrences, verbose, queues):
    days = days.split(',')
    for day in days:
        day_name = day
        day = day_names[day]
        workdate = date.today()
        i = 0
        while i < occurrences:
            if day == workdate.weekday():
                if EscalationExclusion.objects.filter(
                        date=workdate).count() == 0:
                    esc = EscalationExclusion(name='Auto Exclusion for %s' %
                                              day_name,
                                              date=workdate)
                    esc.save()

                    if verbose:
                        print("Created exclusion for %s %s" %
                              (day_name, workdate))

                    for q in queues:
                        esc.queues.add(q)
                        if verbose:
                            print("  - for queue %s" % q)

                i += 1
            workdate += timedelta(days=1)
def create_exclusions(days, occurrences, verbose, queues):
    days = days.split(',')
    for day in days:
        day_name = day
        day = day_names[day]
        workdate = date.today()
        i = 0
        while i < occurrences:
            if day == workdate.weekday():
                if EscalationExclusion.objects.filter(date=workdate).count() == 0:
                    esc = EscalationExclusion(name='Auto Exclusion for %s' % day_name, date=workdate)
                    esc.save()

                    if verbose:
                        print "Created exclusion for %s %s" % (day_name, workdate)

                    for q in queues:
                        esc.queues.add(q)
                        if verbose:
                            print "  - for queue %s" % q

                i += 1
            workdate += timedelta(days=1)