Brackets

Check-in [ebb1395d47]
Login

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

Overview
Comment:starting next section
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256:ebb1395d475c777cb349684f5a9460702168130b6e9f858b0b473117d3a39e63
User & Date: scott 2018-03-22 06:23:54
Context
2018-03-22
17:14
rewrite2 Leaf check-in: 61d471ded0 user: scott tags: trunk
06:23
starting next section check-in: ebb1395d47 user: scott tags: trunk
03:12
add div name to div sheets check-in: 461ec95f53 user: scott tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to Bracket-Builder.py.

5
6
7
8
9
10
11


















12
13
14
15
16
17
18
..
19
20
21
22
23
24
25
26

27
28
29
30
31
32
33
34
35

36
37


38
39
40
41
42
43
44
..
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
103


104

105
106

107
108
109
110
111
112
113
import sys, itertools, collections, csv

'''
def nested_count(lst, x):
    return lst.count(x) + sum(nested_count(l,x) for l in lst if isinstance(l,list))
'''



















def csv_import(csv_fname):
    # This function will import the data from the CSV file and return it as a global variable as well as other instantiations
    divisions = []
    athleteCountByDivision = []
    tabNames = []
    # This section reads in a CSV file
    with open(csv_fname, 'r') as f:
................................................................................
        csv_input = csv.reader(f, dialect='excel', delimiter=",")
        athlete_feed_data_csv = tuple(csv_input)
    # this section sets all of the divisions into a tuple  
    for aclass in athlete_feed_data_csv:
            t = aclass[0] 
            if t not in divisions:
                divisions.append(t)
#    divisions = tuple(divisions)

    # Identify Divisions and Athlete Count
    counter = collections.Counter(itertools.chain(*athlete_feed_data_csv))
    #Found out how many athletes per division
    for div_name in divisions:
        c = counter[div_name]
        x = [div_name, c]
        athleteCountByDivision.append(x)
    for tab_name in divisions:
        divlist = tab_name.split(" ")

        if '&' in divlist:
            divlist[divlist.index('&')] = 'and'


        if divlist[0] == 'Snowboard':
            x = ["SB"] + divlist[1:]
        if divlist[0] == 'Freeski':
            x = ["FS"] + divlist[1:]
        x = " ".join(x)
        tabNames.append(x) 
    return athlete_feed_data_csv, divisions, athleteCountByDivision, tabNames
................................................................................
    # 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()
    sheetNames = []

    for dname in tabNames:
        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
        t = dname[:31]
        sheetNames.append(t)






    #Put division name in the B1 cell of each sheet.
    for dname in tabNames:



        tsheet = doc.sheets[dname]
        tsheet[0,1].value = dname
    
    # Enter all of the divisions with # of athletes into the DivCounts Sheet
    DivCountsSheet = doc.sheets['DivCounts']
    rstart = 1
    cstart = 0
    rstop = len(athleteCountByDivision) + rstart
    cstop = len(athleteCountByDivision[0]) + cstart
    DivCountsSheet[rstart:rstop, cstart:cstop].values = athleteCountByDivision
    
    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(athlete_feed_data_csv) + rstart
    cstop = len(athlete_feed_data_csv[0]) + cstart
    alist[rstart:rstop, cstart:cstop].values = athlete_feed_data_csv

    return 0

def wavecount():
    #This will identify how many waves for the # of athletes including how many LCQ spots
    pass

def heatshape(waves):
    startrow = 0
    startcol = 0




    #Add below variables for Heat and OHeat# (Oheet is overall heat number for comps that day)
    headers = [["Heat#", "" ,"OHeat#","",],["Seed","Bib#","Name","Color","PL"]]



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










>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







 







|
>









>


>
>







 







|
>




|
>
>
>
>
>

|
|
>
>
>










<
|
|






<







|

>
>

>

|
>







5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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
..
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115

116
117
118
119
120
121
122
123

124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
import sys, itertools, collections, csv

'''
def nested_count(lst, x):
    return lst.count(x) + sum(nested_count(l,x) for l in lst if isinstance(l,list))
'''

def divisionmapper(athlete_feed_data_csv):
    new_afdc = []
    for divlist in athlete_feed_data_csv:
        divlist[0] = divlist.split(" ")
        # get rid of the & signs
        if '&' in divlist:
            divlist[divlist.index('&')] = 'and'
        if 'Intellectually Disabled' in divlist:
            divlist[divlist.index('Intellectually Disabled')] = 'ID'
        if divlist[0] == 'Snowboard':
            x = ["SB"] + divlist[1:]
        if divlist[0] == 'Freeski':
            x = ["FS"] + divlist[1:]
        x = " ".join(x)
        new_afdc.append(x)
    athlete_feed_data_csv = new_afdc
    return athlete_feed_data_csv

def csv_import(csv_fname):
    # This function will import the data from the CSV file and return it as a global variable as well as other instantiations
    divisions = []
    athleteCountByDivision = []
    tabNames = []
    # This section reads in a CSV file
    with open(csv_fname, 'r') as f:
................................................................................
        csv_input = csv.reader(f, dialect='excel', delimiter=",")
        athlete_feed_data_csv = tuple(csv_input)
    # this section sets all of the divisions into a tuple  
    for aclass in athlete_feed_data_csv:
            t = aclass[0] 
            if t not in divisions:
                divisions.append(t)
    print(athlete_feed_data_csv[0])
#    athlete_feed_data_csv = divisionmapper(athlete_feed_data_csv)
    # Identify Divisions and Athlete Count
    counter = collections.Counter(itertools.chain(*athlete_feed_data_csv))
    #Found out how many athletes per division
    for div_name in divisions:
        c = counter[div_name]
        x = [div_name, c]
        athleteCountByDivision.append(x)
    for tab_name in divisions:
        divlist = tab_name.split(" ")
        # get rid of the & signs
        if '&' in divlist:
            divlist[divlist.index('&')] = 'and'
        if 'Intellectually Disabled' in divlist:
            divlist[divlist.index('Intellectually Disabled')] = 'ID'
        if divlist[0] == 'Snowboard':
            x = ["SB"] + divlist[1:]
        if divlist[0] == 'Freeski':
            x = ["FS"] + divlist[1:]
        x = " ".join(x)
        tabNames.append(x) 
    return athlete_feed_data_csv, divisions, athleteCountByDivision, tabNames
................................................................................
    # 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()
    heatNames = []
    seedSheetList = []
    for dname in tabNames:
        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
        t = dname[:31]
        heatNames.append(t)
        #Create the Seed input sheets
        seedSheetName = 'I-' + t
        seedSheetName = seedSheetName[:31]
        doc.sheets.copy('SeedTemplate', get_sheet_name(seedSheetName))
        seedSheetList.append(seedSheetName)

    #Put division name in the B1 cell of each heet and seed sheet.
    for dname in heatNames:
        tsheet = doc.sheets[dname]
        tsheet[0,1].value = dname
    for dname in seedSheetList:
        tsheet = doc.sheets[dname]
        tsheet[0,1].value = dname
    
    # Enter all of the divisions with # of athletes into the DivCounts Sheet
    DivCountsSheet = doc.sheets['DivCounts']
    rstart = 1
    cstart = 0
    rstop = len(athleteCountByDivision) + rstart
    cstop = len(athleteCountByDivision[0]) + cstart
    DivCountsSheet[rstart:rstop, cstart:cstop].values = athleteCountByDivision

    alist = doc.sheets['Full Rider List']
    # Feed the athlete full 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(athlete_feed_data_csv) + rstart
    cstop = len(athlete_feed_data_csv[0]) + cstart
    alist[rstart:rstop, cstart:cstop].values = athlete_feed_data_csv

    return 0

def wavecount():
    #This will identify how many waves for the # of athletes including how many LCQ spots
    pass

def heatshape(waves):
    startrow = 6
    startcol = 0
    # What is below is the basic 9 equations going into each cell
    eq1 = ""


    #Add below variables for Heat and OHeat# (Oheet is overall heat number for comps that day)
    Headers = [["Heat#", "" ,"OHeat#","","","","","",""],["Seed","Bib#","Name","Color","PL","1","2","3","4"]]
    


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



Changes to Bracket-template.ods.

cannot compute difference between binary files

Changes to sample1-bxlist.csv.