analytics/maintenance.py
def reset_statistics(stat, frequencies, reset_cumulative, recalculate=False):
    """
    Resets the specified statistic's data (deletes it) for the given
    frequency/ies.
    """

    stats = ensure_list(stat)
    frequencies = ensure_list(frequencies)

    for s in stats:
        for f in frequencies:
            if not s.cumulative or reset_cumulative:
                print "Resetting %s (%s)..." % (s.__name__, settings.STATISTIC_FREQUENCY_DICT[f])
                s.objects.filter(frequency=f).delete()
            elif s.cumulative and not reset_cumulative:
                print "Skipping %s because it is cumulative." % s.__name__

    if recalculate:
        print "Recalculating statistics..."
        calculate_statistics(stats, frequencies)
def reset_statistics(stat, frequencies, reset_cumulative, recalculate=False):
    """
    Resets the specified statistic's data (deletes it) for the given
    frequency/ies.
    """

    stats = ensure_list(stat)
    frequencies = ensure_list(frequencies)

    for s in stats:
        for f in frequencies:
            if not s.cumulative or reset_cumulative:
                print "Resetting %s (%s)..." % (s.__name__, settings.STATISTIC_FREQUENCY_DICT[f])
                s.objects.filter(frequency=f).delete()
            elif s.cumulative and not reset_cumulative:
                print "Skipping %s because it is cumulative." % s.__name__

    if recalculate:
        print "Recalculating statistics..."
        calculate_statistics(stats, frequencies)
Resets the specified statistic's data (deletes it) for the given
    frequency/ies.