Brackets

Check-in [f361b4de39]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:wrapping for night2
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256:f361b4de399e17d79b3e8e101d77389409c0d8c9f7a946f48a1ed80ae435f7d9
User & Date: scott 2018-03-21 07:36:46
Context
2018-03-21
16:24
working code check-in: 5ffa5ced86 user: scott tags: trunk
07:36
wrapping for night2 check-in: f361b4de39 user: scott tags: trunk
06:52
wrapping for night check-in: ff8044da96 user: scott tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to Bracket-Builder.py.

    24     24           csv_data = tuple(csv_input)
    25     25       # this section sets all of the divisions into a tuple  
    26     26       for aclass in csv_data:
    27     27               t = aclass[0] 
    28     28               if t not in divisions:
    29     29                   divisions.append(t)
    30     30       divisions = tuple(divisions)
           31  +    # Identify Divisions and Athlete Count
           32  +    for div_num in divisions:
           33  +        x = csv_data.count(div_num)
           34  +        n = div_num, x
           35  +        div_count.append(n)
           36  +    div_count = tuple(div_count)
           37  +    print("div count", div_count)
           38  +    '''
    31     39       # This section counts how many are in each division
    32     40       for div_num in divisions:
    33     41               # below is division, number of athletes per division, Remainder, and # of heats required to get all athletes into a heat
    34     42               x = div_num.split("_")
    35     43               x = x[0]
    36     44               y = nested_count(csv_data, x)
    37     45               n = div_num, y, y % 4, y//4 
    38     46               div_count.append(n)
    39     47       div_count = tuple(div_count)
           48  +    print("div_count: ", div_count)
           49  +    '''
    40     50       return csv_data, divisions, div_count
    41     51   
    42     52   def main(args):
    43     53   #the main program that makes everything work
    44     54   
    45     55   #feed in filename of csv file in base path
    46     56       csv_fname = input("Enter the name of the CSV File: ")
    47     57       if csv_fname == "":
    48     58           csv_fname = 'F:\Python-Dev\Brackets-Nationals\sample1-bxlist.csv'
    49     59       csv_data, divisions, div_count = csv_import(csv_fname)
    50         -    sheet_build(csv_data, divisions)
           60  +    doc = sheet_build(csv_data, divisions, div_count)
    51     61   
    52     62       return 0 
    53     63   
    54         -def sheet_build(csv_data, divisions):
           64  +def sheet_build(csv_data, divisions, div_count):
    55     65       import pyoo
    56     66       # Stuff around opening up a sheet and feeding in data
    57     67       desktop = pyoo.Desktop('localhost', 2002)
    58     68       doc = desktop.open_spreadsheet('F:\Python-Dev\Brackets-Nationals\Bracket-template.ods')
    59     69       #doc = desktop.create_spreadsheet()
    60     70   
    61     71       # Create all of the worksheets and populate with basic information
................................................................................
    64     74           doc.sheets.copy('Bracket-Template', get_sheet_name(dname))
    65     75           # libreoffice tab length is 31 characters, this will correct this but still put in full name
    66     76           sheetNames = []
    67     77           if len(dname) > 31:
    68     78               dshort = dname[:31]
    69     79               tlist = doc.sheets[dshort]
    70     80               tlist[0,1].value = dname
    71         -            #Collect the sheet names for returning to later
           81  +            #Collect the sheet names for returning to later !!! broken
    72     82               sheetNames.append(dshort)
    73     83           else:
    74     84               tlist = doc.sheets[dname]
    75     85               tlist[0,1].value = dname
    76         -            # collect the sheet names for returning to later
           86  +            # collect the sheet names for returning to later !!! broken
    77     87               sheetNames.append(dname)
    78         -    # Enter all of the Sheet names into the DivCounts Sheet
    79         -    print(sheetNames)
           88  +    '''  Broken above, not getting the counts in the nested list
           89  +    # Enter all of the divisions with # of athletes into the DivCounts Sheet
    80     90       DivCountsSheet = doc.sheets['DivCounts']
    81         -    row = 1
    82         -    col = 0
    83         -    for sname in sheetNames:
    84         -        DivCountsSheet[row, col].value = sname
    85         -        row = row + 1
           91  +    rstart = 1
           92  +    cstart = 0
           93  +    rstop = len(div_count)
           94  +    cstop = len(div_count[0])
           95  +    DivCountsSheet[rstart:rstop, cstart,cstop].values = div_count
           96  +    '''
    86     97   
    87     98       alist = doc.sheets[1]
    88     99       # Feed the athlete list
    89    100       # Geometry set for putting data in the startlist (counting starts at 0; r is row and c is column)
    90    101       rstart = 3
    91    102       cstart = 0
    92    103       rstop = len(csv_data) + rstart
    93         -    cstop = len(csv_data[1]) + cstart
          104  +    cstop = len(csv_data[0]) + cstart
    94    105       alist[rstart:rstop, cstart:cstop].values = csv_data
    95    106   
    96         -    return 0
          107  +    return doc
          108  +
          109  +def wavecount():
          110  +    #This will identify how many waves for the # of athletes including how many LCQ spots
          111  +    pass
          112  +
          113  +def heatshape(waves):
          114  +    startrow = 0
          115  +    startcol = 0
          116  +
          117  +    #Add below variables for Heat and OHeat# (Oheet is overall heat number for comps that day)
          118  +    headers = [["Heat#", ,"OHeat#",,],["Seed","Bib#","Name","Color","PL"]]
          119  +
    97    120   
    98    121   if __name__ == '__main__':
    99    122       sys.exit(main(sys.argv))
   100    123   
   101    124   
   102    125