Skip to content

Commit 8b6d24f

Browse files
committed
fixed budget downloading error
1 parent 3c637ed commit 8b6d24f

3 files changed

Lines changed: 44 additions & 18 deletions

File tree

api/API/makeExcel.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def makeBudgetExcel():
5353

5454
workbook = xlsxwriter.Workbook(writeFilePath)
5555
workbook.set_properties({
56-
'title': 'Budget for {}'.format(applicationCycle.year),
56+
'title': 'Budget for {}'.format(params.year),
5757
'author': 'URCPP System',
5858
'comments': 'Created with Python and XlsxWriter'})
5959

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<ul class="nav nav-tabs">
2+
{% for menuItem in cfg["committee"] %}
3+
<li role="presentation"><a href="{{url_for(menuItem['link'])}}">{{menuItem['title']}}</a></li>
4+
{% endfor %}
5+
</ul>

sync_faculty.py

Lines changed: 38 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -28,26 +28,37 @@ def safe (d, k):
2828
result = ""
2929
try:
3030
if k in d:
31+
print("Result: ", d[k])
3132
result = d[k]
3233
# If we can't find a key, skip it.
3334
except:
35+
print("Skipping: ", d, k)
3436
pass
35-
3637
return result
3738

3839
# Recreate the table.
3940
theStaticDB.create_table(LDAPFaculty)
4041

4142
faculty = conn.entries
4243
for fac in faculty:
43-
print ("Faculty: {0}".format(fac.samaccountname))
44-
o = LDAPFaculty (
45-
lastname = safe (fac, 'sn'),
46-
firstname = safe (fac, 'givenname'),
47-
username = fac.samaccountname,
48-
bnumber = safe (fac, 'employeeid'),
49-
)
50-
o.save()
44+
try:
45+
if str(fac.samaccountname) != 'ptfaculty':
46+
print ("Faculty: {0}".format(fac.samaccountname))
47+
o, c = LDAPFaculty.get_or_create(
48+
lastname = safe (fac, 'sn'),
49+
firstname = safe (fac, 'givenname'),
50+
username = fac.samaccountname,
51+
bnumber = safe (fac, 'employeeid')
52+
)
53+
except:
54+
print("Error")
55+
#o = LDAPFaculty (
56+
# lastname = safe (fac, 'sn'),
57+
# firstname = safe (fac, 'givenname'),
58+
# username = fac.samaccountname,
59+
# bnumber = safe (fac, 'employeeid'),
60+
# )
61+
#o.save()
5162

5263

5364
# Now do Staff
@@ -61,11 +72,21 @@ def safe (d, k):
6172

6273
faculty = conn.entries #actually staff, but who cares?
6374
for fac in faculty:
64-
print ("Staff: {0}".format(fac.samaccountname))
65-
o = LDAPFaculty (
66-
lastname = safe (fac, 'sn'),
67-
firstname = safe (fac, 'givenname'),
68-
username = fac.samaccountname,
69-
bnumber = safe (fac, 'employeeid'),
70-
)
71-
o.save()
75+
try:
76+
if str(fac.samaccountname) != 'ptfaculty':
77+
print ("Staff: {0}".format(fac.samaccountname))
78+
o, c = LDAPFaculty.get_or_create(
79+
lastname = safe (fac, 'sn'),
80+
firstname = safe (fac, 'givenname'),
81+
username = fac.samaccountname,
82+
bnumber = safe (fac, 'employeeid')
83+
)
84+
except:
85+
print("Error")
86+
#o = LDAPFaculty (
87+
# lastname = safe (fac, 'sn'),
88+
# firstname = safe (fac, 'givenname'),
89+
# username = fac.samaccountname,
90+
# bnumber = safe (fac, 'employeeid'),
91+
# )
92+
# o.save()

0 commit comments

Comments
 (0)