summaryrefslogtreecommitdiffstats
path: root/askbot/management/commands/base_command.py
blob: 46a2d7a7a06c1ef98a366ba1a8ca1ff1ca272cd8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
"""
#-------------------------------------------------------------------------------
# Name:        Award badges command
# Purpose:     This is a command file croning in background process regularly to
#              query database and award badges for user's special acitivities.
#
# Author:      Mike, Sailing
#
# Created:     22/01/2009
# Copyright:   (c) Mike 2009
# Licence:     GPL V2
#-------------------------------------------------------------------------------
"""
#!/usr/bin/env python
#encoding:utf-8

from django.core.management.base import NoArgsCommand

class BaseCommand(NoArgsCommand):
    def update_activities_auditted(self, cursor, activity_ids):
        # update processed rows to auditted
        if len(activity_ids):
            query = "UPDATE activity SET is_auditted = 1 WHERE id in (%s)"\
                    % ','.join('%s' % item for item in activity_ids)
            cursor.execute(query)