Brackets

Check-in [ff8044da96]
Login

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

Overview
Comment:wrapping for night
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256:ff8044da969130604520724601002ee9c22cd83c6c8742021a45e4cac79dccb7
User & Date: scott 2018-03-21 06:52:14
Context
2018-03-21
07:36
wrapping for night2 check-in: f361b4de39 user: scott tags: trunk
06:52
wrapping for night check-in: ff8044da96 user: scott tags: trunk
04:22
sysmove check-in: 40932702b0 user: scott tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to Bracket-Builder.py.

33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69

70
71
72
73
74
75
76
77
78
79
80






81
















82
83





84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
            # below is division, number of athletes per division, Remainder, and # of heats required to get all athletes into a heat
            x = div_num.split("_")
            x = x[0]
            y = nested_count(csv_data, x)
            n = div_num, y, y % 4, y//4 
            div_count.append(n)
    div_count = tuple(div_count)
 
    
    return csv_data, divisions, div_count

   
    

''' Commented out when it was added to the csv import function
def division_ident():
    global divisions
    divisions = tuple([])
    for aclass in csv_data:
        t = aclass[0]
        if t not in divisions:
            divisions.append(t)
    return divisions
'''

def main(args):
#the main program that makes everything work

#feed in filename of csv file in base path
    csv_fname = input("Enter the name of the CSV File: ")
    if csv_fname == "":
        csv_fname = 'F:\Python-Dev\Brackets-Nationals\sample1-bxlist.csv'
    csv_data, divisions, div_count = csv_import(csv_fname)
#    athlete_tuples()   
#    print(csv_data)
#    print(len(csv_data))
    sheet_build(csv_data)

    return 0 

def sheet_build(csv_data):
    import pyoo
    # Stuff around opening up a sheet and feeding in data
    desktop = pyoo.Desktop('localhost', 2002)
    #doc = desktop.open_spreadsheet('F:\Python-Dev\Brackets-Nationals\Bracket-template.ods')
    doc = desktop.create_spreadsheet()

    # Feed the athlete list
    doc.sheets.create('AgeClassReport', index=1)






    sheet = doc.sheets[1]

















    # get the size of the csv file





    length = len(csv_data) + 1
    width = len(csv_data[1])
    print(length)
    print(width)
    print(csv_data)
    sheet[0:0].value = 1
    sheet[1:length, 0:width].values = csv_data

    return 0

if __name__ == '__main__':
    sys.exit(main(sys.argv))










<
<


<
<
<
<
<
<
<
<
<
<
<
<
<
<








<
<
<
|
>


|



|
|

|
|
>
>
>
>
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>

<
>
>
>
>
>
|
|
<
<
<
<
|








33
34
35
36
37
38
39


40
41














42
43
44
45
46
47
48
49



50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86

87
88
89
90
91
92
93




94
95
96
97
98
99
100
101
102
            # below is division, number of athletes per division, Remainder, and # of heats required to get all athletes into a heat
            x = div_num.split("_")
            x = x[0]
            y = nested_count(csv_data, x)
            n = div_num, y, y % 4, y//4 
            div_count.append(n)
    div_count = tuple(div_count)


    return csv_data, divisions, div_count















def main(args):
#the main program that makes everything work

#feed in filename of csv file in base path
    csv_fname = input("Enter the name of the CSV File: ")
    if csv_fname == "":
        csv_fname = 'F:\Python-Dev\Brackets-Nationals\sample1-bxlist.csv'
    csv_data, divisions, div_count = csv_import(csv_fname)



    sheet_build(csv_data, divisions)

    return 0 

def sheet_build(csv_data, divisions):
    import pyoo
    # Stuff around opening up a sheet and feeding in data
    desktop = pyoo.Desktop('localhost', 2002)
    doc = desktop.open_spreadsheet('F:\Python-Dev\Brackets-Nationals\Bracket-template.ods')
    #doc = desktop.create_spreadsheet()

    # Create all of the worksheets and populate with basic information
    get_sheet_name = pyoo.NameGenerator()
    for dname in divisions:
        doc.sheets.copy('Bracket-Template', get_sheet_name(dname))
        # libreoffice tab length is 31 characters, this will correct this but still put in full name
        sheetNames = []
        if len(dname) > 31:
            dshort = dname[:31]
            tlist = doc.sheets[dshort]
            tlist[0,1].value = dname
            #Collect the sheet names for returning to later
            sheetNames.append(dshort)
        else:
            tlist = doc.sheets[dname]
            tlist[0,1].value = dname
            # collect the sheet names for returning to later
            sheetNames.append(dname)
    # Enter all of the Sheet names into the DivCounts Sheet
    print(sheetNames)
    DivCountsSheet = doc.sheets['DivCounts']
    row = 1
    col = 0
    for sname in sheetNames:
        DivCountsSheet[row, col].value = sname
        row = row + 1


    alist = doc.sheets[1]
    # Feed the athlete list
    # Geometry set for putting data in the startlist (counting starts at 0; r is row and c is column)
    rstart = 3
    cstart = 0
    rstop = len(csv_data) + rstart
    cstop = len(csv_data[1]) + cstart




    alist[rstart:rstop, cstart:cstop].values = csv_data

    return 0

if __name__ == '__main__':
    sys.exit(main(sys.argv))



Changes to Bracket-template.ods.

cannot compute difference between binary files

Changes to sample1-bxlist.csv.

1
2
3
4
5
6
7
8
Boarder Division Display,Gender,Bib Display,Boarder Name,Seed
Freeski Breaker (12-13) Boys,Male,109,Erik Jaerbyn,21.58933195
Freeski Breaker (12-13) Boys,Male,77,Whitton Hyde,20.79543484
Freeski Breaker (12-13) Girls,Female,1,Lindsey LaBaugh,9.478337416
Freeski Junior (16-17) Women,Female,2,Emily Sanner,15.84103726
Freeski Menehune (10-11) Boys,Male,564,Cooper Huggins,26.38438443
Freeski Menehune (10-11) Boys,Male,6636,Gavin Goike,1007.331743
Freeski Menehune (10-11) Boys,Male,7797,George Ogden,1007.604179
<








1
2
3
4
5
6
7

Freeski Breaker (12-13) Boys,Male,109,Erik Jaerbyn,21.58933195
Freeski Breaker (12-13) Boys,Male,77,Whitton Hyde,20.79543484
Freeski Breaker (12-13) Girls,Female,1,Lindsey LaBaugh,9.478337416
Freeski Junior (16-17) Women,Female,2,Emily Sanner,15.84103726
Freeski Menehune (10-11) Boys,Male,564,Cooper Huggins,26.38438443
Freeski Menehune (10-11) Boys,Male,6636,Gavin Goike,1007.331743
Freeski Menehune (10-11) Boys,Male,7797,George Ogden,1007.604179