Exemple #1
0
if parms.newAlignment:
    overrideClubs(clubs, parms.newAlignment, exclusive=False)

# Remove suspended clubs
clubs = removeSuspendedClubs(clubs, curs)

# Remove clubs from outside our District
for c in list(clubs.keys()):
    try:
        if int(clubs[c].district) != parms.district:
            del clubs[c]
    except ValueError:
        print((clubs[c]))

# Add current coordinates and remove clubs without coordinates (unless there's a new alignment)
setClubCoordinatesFromGEO(clubs, curs, removeNotInGeo=not parms.newAlignment)

# If there are overrides to club positioning, handle them now
if parms.mapoverride:
    overrideClubPositions(clubs, parms.mapoverride, parms.googlemapsapikey)

# Now, assign clubs to Areas and Divisions

for c in sorted(clubs):
    club = clubs[c]
    Area.find(club.division, club.area).addclub(club)

# OK, now we have the club info.  Let's get the Area Director/Division Director information.
for row in GSheet(parms.officers, apikey=parms.googlesheetsapikey):
    for k in row.fieldnames:
        setattr(row, k, ' '.join(str(getattr(row, k))).split())
Exemple #2
0
        '--includeprecharter',
        dest='includeprecharter',
        action='store_true',
        help=
        'Specify this to include "pre-charter" clubs (ones with negative club numbers in the newalignment file)'
    )

    # Do global setup
    myglobals.setup(parms, sections='alignment')
    conn = myglobals.conn
    curs = myglobals.curs

    # Get all defined clubs from the database.
    clubs = Club.getClubsOn(curs)
    # Get coordinates
    setClubCoordinatesFromGEO(clubs, curs, removeNotInGeo=False)
    # If there are overrides to club positioning, handle them now
    if parms.mapoverride:
        print(('Processing general overrides from %s' % parms.mapoverride))
        overrideClubPositions(clubs,
                              parms.mapoverride,
                              parms.googlemapsapikey,
                              log=True,
                              createnewclubs=True)

    # Now, add info from clubperf (and create club.oldarea for each club)
    # We use the 'lastfor' table to get information for all clubs, even those which Toastmasters dropped from
    #   the list because they were suspended for two renewal cycles.
    curs.execute(
        '''SELECT clubnumber, clubname, division, area, color, goalsmet, activemembers, clubstatus FROM clubperf 
                    WHERE id in (SELECT clubperf_id FROM lastfor WHERE tmyear = %s)''',
Exemple #3
0
  parms.add_argument('--quiet', '-q', action='count')
  parms.add_argument('--outfile', default='d101align.csv')
  parms.add_argument('--mapoverride', dest='mapoverride', default=None, help='Google spreadsheet with overriding address and coordinate information')
  parms.add_argument('--alignment', dest='alignment', default=None, help='Use this file instead of going to Dropbox.')
  # Add other parameters here
  parms.parse() 
  
 
  # Connect to the database        
  conn = dbconn.dbconn(parms.dbhost, parms.dbuser, parms.dbpass, parms.dbname)
  curs = conn.cursor()
  
  # Get all defined clubs from the database.
  clubs = Club.getClubsOn(curs)
  # Get coordinates
  setClubCoordinatesFromGEO(clubs, curs, removeNotInGeo=False)
  # If there are overrides to club positioning, handle them now
  if parms.mapoverride:
      overrideClubPositions(clubs, parms.mapoverride, parms.googlemapsapikey)
  ourclubs = {}
  
  # Now, add info from clubperf (and create club.oldarea for each club)
  curs.execute('SELECT clubnumber, color, goalsmet, activemembers FROM clubperf WHERE entrytype = "L"')
  for (clubnumber, color, goalsmet, activemembers) in curs.fetchall():
      c = clubs[str(clubnumber)]
      c.color = color
      c.goalsmet = goalsmet
      c.activemembers = activemembers
      c.oldarea = c.division + c.area