コード例 #1
0
 def __init__(self, row):
     for key in row:
         nkey = tmutil.normalize(key)
         # Make sure columns that should be numbers are!
         if 'name' not in nkey:
             row[key] = makeint(row[key])
         setattr(self, nkey, row[key])
     self.name = self.firstname.strip() + ' ' + self.lastname.strip()
コード例 #2
0
ファイル: makecap.py プロジェクト: dssinger/tmstats
 def __init__(self, row):
     for key in row:
         nkey = tmutil.normalize(key)
         # Make sure columns that should be numbers are!
         if 'name' not in nkey:
             row[key] = makeint(row[key])
         setattr(self, nkey, row[key])
     self.name = self.firstname.strip() + ' ' + self.lastname.strip()
コード例 #3
0
ファイル: makecap.py プロジェクト: djrachlin/tmstats
    def __init__(self, row):
        for key in row:
            nkey = tmutil.normalize(key)
            setattr(self, nkey, row[key])

        if self.clubnumber:
            self.clubnumber = '%d' % self.clubnumber
            try:
                self.clubname = allclubs[self.clubnumber].clubname
            except KeyError:
                pass

        if self.clubname.endswith('*'):
            self.clubname = self.clubname[:-1]
コード例 #4
0
ファイル: makecap.py プロジェクト: dssinger/tmstats
    def __init__(self, row):
        for key in row:
            nkey = tmutil.normalize(key)
            if nkey == 'visits':
                row[key] = makeint(row[key])
            setattr(self, nkey, row[key])

        if self.clubnumber:
            self.clubnumber = '%d' % self.clubnumber
            try:
                self.clubname = allclubs[self.clubnumber].clubname
            except KeyError:
                pass
            
        if self.clubname.endswith('*'):
            self.clubname = self.clubname[:-1]
コード例 #5
0
    def __init__(self, row):
        for key in row:
            nkey = tmutil.normalize(key)
            if nkey == 'clubnumber':
                setattr(self, nkey, row[key])
            else:
                val = ('%s' % row[key]).strip()
                if nkey not in (('notes', 'contact')):
                    val = ' '.join(val.split())
                setattr(self, nkey, val)

        if self.clubnumber:
            self.clubnumber = '%d' % self.clubnumber
            try:
                self.clubname = allclubs[self.clubnumber].clubname
            except KeyError:
                pass
コード例 #6
0
ファイル: makefeaturedclubs.py プロジェクト: dssinger/tmstats
    def __init__(self, row):
        for key in row:
            nkey = tmutil.normalize(key)
            if nkey == 'clubnumber':
                setattr(self, nkey, row[key])
            else:
                val = ('%s' % row[key]).strip()
                if nkey not in( ('notes', 'contact')):
                    val = ' '.join(val.split())
                setattr(self, nkey, val)

        if self.clubnumber:
            self.clubnumber = '%d' % self.clubnumber
            try:
                self.clubname = allclubs[self.clubnumber].clubname
            except KeyError:
                pass
コード例 #7
0
    outfile.write("""
    <table id="credits" class="compact stripe row-border">
      <thead>
        <tr>
        <th>Area</th>
        <th>Club Number</th>
        <th>Club Name</th>
        <th>Earned</th>
        <th>Available</th>
        </tr>
      </thead>
      <tbody>
""")
    # Labels are in row 3
    labels = sheet.row_values(3)
    nlabels = [normalize(c) for c in labels]

    # Find 'ID' (club number), 'TOTAL CREDITS' and 'BALANCE CREDITS'
    #   We'll pick up club name and alignment from the database

    idcol = nlabels.index('id')
    namecol = nlabels.index('name')
    credcol = nlabels.index('totalcredits')
    balancecol = nlabels.index('balancecredits')
    areacol = nlabels.index('area')

    clubs = Club.getClubsOn(curs)

    # Values begin in row 4
    for row in sheet.get_all_values()[3:]:
        clubnum = row[idcol]
コード例 #8
0
    parms.add_argument('--prize1', default='an Amazing Gift Basket ($45 value)')
    parms.add_argument('--prize2', default='an even more Amazing Gift Basket ($70 value)')
    parms.add_argument('--needed', default=3)

    # Do global setup
    myglobals.setup(parms)
    curs = myglobals.curs
    conn = myglobals.conn

    winners = [[],[]]  # List of clubnames for each level.

    # Get the spreadsheet
    gc = gspread.authorize(getGoogleCredentials())
    sheet = gc.open_by_url(parms.anniversaryopenhouse).sheet1
    values = sheet.get_all_values()
    labels = [normalize(c) for c in values[0]]
    deltacolumn = labels.index('newmembersadded') + 1
    eligiblethroughcol = labels.index('eligiblethrough') + 1


    # Get the final date in the database - we don't ask for data later than we have!
    curs.execute("SELECT MAX(asof) FROM clubperf")
    maxasof = curs.fetchone()[0]



    for rownum, row in enumerate(values[1:], start=2):
        club = Clubinfo(labels, row)
        clubnumber = club.clubnumber.strip()
        if not clubnumber:
            continue
コード例 #9
0
ファイル: makecap.py プロジェクト: djrachlin/tmstats
 def __init__(self, row):
     for key in row:
         nkey = tmutil.normalize(key)
         setattr(self, nkey, row[key])
     self.name = self.firstname.strip() + ' ' + self.lastname.strip()