Пример #1
0
#!/usr/bin/env python3
import tmparms, os, sys
from datetime import date, datetime
from tmutil import showclubswithvalues, showclubswithoutvalues
import argparse

import tmglobals
globals = tmglobals.tmglobals()

def inform(*args, **kwargs):
    """ Print information to 'file' unless suppressed by the -quiet option.
          suppress is the minimum number of 'quiet's that need be specified for
          this message NOT to be printed. """
    suppress = kwargs.get('suppress', 1)
    file = kwargs.get('file', sys.stderr)
    
    if parms.quiet < suppress:
        print(' '.join(args), file=file)
        
class myclub:
    """ Just enough club info to sort the list nicely """
    def __init__(self, clubnumber, clubname, net, division, area):
        self.area = '%s%s' % (division, area)
        self.clubnumber = clubnumber
        self.clubname = clubname
        self.net = net
        self.area = '%s%s' % (division, area)

    def tablepart(self):
        return ('    <td>%s</td><td>%s</td><td>%d</td>' % (self.area, self.clubname, self.net))
        
Пример #2
0
#!/usr/bin/env python3
""" Creates Stellar September/March Madness reports from the District Tracking Google Spreadsheet"""

import tmutil, sys
import tmglobals
from gsheet import GSheet
myglobals = tmglobals.tmglobals()

    
class level:
    def __init__(self, pct, earns, name):
        self.pct = pct
        self.earns = earns
        self.name = name
        self.winners = []


class myclub:
    """ Just enough club info to sort the list nicely """
    def __init__(self, clubnumber, clubname,  renewals, membase, division, area):
        self.area = '%s%s' % (division, area)
        self.clubnumber = clubnumber
        self.clubname = clubname
        if renewals:
            self.renewals = int(renewals)
        else:
            self.renewals = 0
        self.membase = int(membase)
        if self.membase > 0:
            self.pct = (100.0 * self.renewals) / self.membase
        else:
Пример #3
0
                (self.area, self.clubname, self.goalsmet))

    def key(self):
        return (self.area, self.clubnumber)


# Establish parameters
parms = tmparms.tmparms()
parms.parser.add_argument("--toend", dest='toend', type=int, default=10)
parms.parser.add_argument("--outfileprefix",
                          dest='outfileprefix',
                          type=str,
                          default='earlyachievers')

# Set up global environment
myglobals = tmglobals.tmglobals(parms)

conn = myglobals.conn
curs = myglobals.curs
today = myglobals.today
endmonth = '%d-%0.2d-01' % (myglobals.tmyear, parms.toend)

# If there's monthly data for the end date, use it; otherwise, use
#   today's data.
curs.execute(
    "SELECT clubnumber, clubname, asof, goalsmet, division, area FROM clubperf WHERE monthstart=%s AND entrytype = 'M'",
    (endmonth, ))
if curs.rowcount:
    final = True
else:
    # No data returned; use today's data instead
Пример #4
0
#!/usr/bin/env python3
""" This program combines info about a Toastmasters District's clubs into one easy-to-read report.  """

import datetime, math, time
import tmparms, latest, os, sys
from tmutil import stringify
import csv

from operator import attrgetter

from tmglobals import tmglobals
myglobals = tmglobals()

dists = {
    'P': 'President\'s Distinguished = %d',
    'S': 'Select Distinguished = %d',
    'D': 'Distinguished = %d'
}

distnames = [
    'Distinguished', 'Select Distinguished', 'President\'s Distinguished'
]

clubs = {}
divisions = {}

### Utility Functions ###


def monthtoindex(m):
    if m >= 7:
Пример #5
0
    def tablepart(self):
        return ('    <td>%s</td><td>%s</td><td>%d</td>' % (self.area, self.clubname, self.goalsmet))

    def key(self):
        return (self.area, self.clubnumber)




# Establish parameters
parms = tmparms.tmparms()
parms.parser.add_argument("--toend", dest='toend', type=int, default=10)
parms.parser.add_argument("--outfileprefix", dest='outfileprefix', type=str, default='earlyachievers')

# Set up global environment
globals = tmglobals.tmglobals(parms)

conn = globals.conn
curs = globals.curs
today = globals.today
endmonth = '%d-%0.2d-01' % (globals.tmyear, parms.toend)


# If there's monthly data for the end date, use it; otherwise, use
#   today's data.
curs.execute("SELECT clubnumber, clubname, asof, goalsmet, division, area FROM clubperf WHERE monthstart=%s AND entrytype = 'M'", (endmonth,))
if curs.rowcount:
    final = True
else:
    # No data returned; use today's data instead
    curs.execute("SELECT clubnumber, clubname, asof, goalsmet, division, area FROM clubperf WHERE entrytype = 'L' AND district = %s", (parms.district,))