Skip to content

Commit db0b9b6

Browse files
Merge pull request #46 from ComputerScienceHouse/develop
Conditional v1.0.2
2 parents b963270 + 92ed039 commit db0b9b6

21 files changed

+144
-38
lines changed

conditional/blueprints/dashboard.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,9 @@ def display_dashboard():
108108
housing['points'] = ldap_get_housing_points(user_name)
109109
housing['room'] = ldap_get_room_number(user_name)
110110
if housing['room'] == "N/A":
111-
housing['queue_pos'] = get_queue_position(user_name)
111+
housing['queue_pos'] = "%s / %s" % (get_queue_position(user_name), get_queue_length())
112112
else:
113-
housing['queue_pos'] = "On Floor"
114-
housing['queue_len'] = get_queue_length()
113+
housing['queue_pos'] = "N/A"
115114
else:
116115
housing = None
117116

conditional/blueprints/intro_evals.py

Lines changed: 59 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
from datetime import datetime
12
import uuid
23
import structlog
34

@@ -6,8 +7,12 @@
67
from conditional.util.ldap import ldap_get_intro_members
78
from conditional.util.ldap import ldap_get_name
89

10+
from conditional.models.models import FreshmanCommitteeAttendance
911
from conditional.models.models import MemberCommitteeAttendance
12+
from conditional.models.models import FreshmanAccount
1013
from conditional.models.models import FreshmanEvalData
14+
from conditional.models.models import FreshmanHouseMeetingAttendance
15+
from conditional.models.models import FreshmanSeminarAttendance
1116
from conditional.models.models import MemberHouseMeetingAttendance
1217
from conditional.models.models import MemberSeminarAttendance
1318
from conditional.models.models import HouseMeeting
@@ -26,17 +31,68 @@ def display_intro_evals(internal=False):
2631
log.info('frontend', action='display intro evals listing')
2732

2833
# get user data
29-
def get_cm_count(member_id):
34+
def get_uid_cm_count(member_id):
3035
return len([a for a in MemberCommitteeAttendance.query.filter(
3136
MemberCommitteeAttendance.uid == member_id)])
3237

38+
def get_fid_cm_count(member_id):
39+
return len([a for a in FreshmanCommitteeAttendance.query.filter(
40+
FreshmanCommitteeAttendance.fid == member_id)])
41+
3342
user_name = None
3443
if not internal:
3544
user_name = request.headers.get('x-webauth-user')
3645

3746
members = [m['uid'] for m in ldap_get_intro_members()]
3847

3948
ie_members = []
49+
50+
# freshmen who don't have accounts
51+
fids = [f for f in FreshmanAccount.query.filter(
52+
FreshmanAccount.eval_date > datetime.now())]
53+
54+
for fid in fids:
55+
h_meetings = [m.meeting_id for m in
56+
FreshmanHouseMeetingAttendance.query.filter(
57+
FreshmanHouseMeetingAttendance.fid == fid.id
58+
).filter(
59+
FreshmanHouseMeetingAttendance.attendance_status == "Absent"
60+
)]
61+
freshman = {
62+
'name': fid.name,
63+
'uid': fid.id,
64+
'eval_date': fid.eval_date.strftime("%Y-%m-%d"),
65+
'signatures_missed': 65535,
66+
'committee_meetings': get_fid_cm_count(fid.id),
67+
'committee_meetings_passed': get_fid_cm_count(fid.id) >= 10,
68+
'house_meetings_missed':
69+
[
70+
{
71+
"date": m.date.strftime("%Y-%m-%d"),
72+
"reason":
73+
FreshmanHouseMeetingAttendance.query.filter(
74+
FreshmanHouseMeetingAttendance.fid == fid.id).filter(
75+
FreshmanHouseMeetingAttendance.meeting_id == m.id).first().excuse
76+
}
77+
for m in HouseMeeting.query.filter(
78+
HouseMeeting.id.in_(h_meetings)
79+
)
80+
],
81+
'technical_seminars':
82+
[s.name for s in TechnicalSeminar.query.filter(
83+
TechnicalSeminar.id.in_(
84+
[a.seminar_id for a in FreshmanSeminarAttendance.query.filter(
85+
FreshmanSeminarAttendance.fid == fid.id)]
86+
))
87+
],
88+
'social_events': '',
89+
'freshman_project': "Pending",
90+
'comments': 'Does not have account yet',
91+
'status': "Pending"
92+
}
93+
ie_members.append(freshman)
94+
95+
# freshmen who have accounts
4096
for member_uid in members:
4197
uid = member_uid[0].decode('utf-8')
4298
freshman_data = FreshmanEvalData.query.filter(
@@ -57,8 +113,8 @@ def get_cm_count(member_id):
57113
'uid': uid,
58114
'eval_date': freshman_data.eval_date.strftime("%Y-%m-%d"),
59115
'signatures_missed': freshman_data.signatures_missed,
60-
'committee_meetings': get_cm_count(uid),
61-
'committee_meetings_passed': get_cm_count(uid) >= 10,
116+
'committee_meetings': get_uid_cm_count(uid),
117+
'committee_meetings_passed': get_uid_cm_count(uid) >= 10,
62118
'house_meetings_missed':
63119
[
64120
{

conditional/blueprints/member_management.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,10 @@ def member_management_adduser():
169169
onfloor_status = post_data['onfloor']
170170
room_number = post_data['roomNumber']
171171

172+
# empty room numbers should be NULL
173+
if room_number == "":
174+
room_number = None
175+
172176
logger.info('backend', action="add f_%s as onfloor: %s with room_number: %s" % (name, onfloor_status, room_number))
173177
db.session.add(FreshmanAccount(name, onfloor_status, room_number))
174178
db.session.flush()

conditional/templates/attendance_cm.html

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
{% extends "nav.html" %}
2+
{% block title %}
3+
Directorship Meeting Attendance
4+
{% endblock %}
25
{% block body %}
36
<div class="container main">
4-
<h3 class="page-title">Committee Attendance</h3>
7+
<h3 class="page-title">Meeting Attendance</h3>
58
<form data-module="attendanceForm" data-type="committee">
69
<!-- Meeting Type -->
710
<div class="row">

conditional/templates/attendance_hm.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
{% extends "nav.html" %}
2+
{% block title %}
3+
House Meeting Attendance
4+
{% endblock %}
25
{% block body %}
36
<div class="container main">
47
<h3>House Meeting Attendance</h3>

conditional/templates/attendance_ts.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
{% extends "nav.html" %}
2+
{% block title %}
3+
Seminar Attendance
4+
{% endblock %}
25
{% block body %}
36
<div class="container main">
47
<h3 class="page-title">Seminar Attendance</h3>

conditional/templates/conditional.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
{% extends "nav.html" %}
2+
{% block title %}
3+
Conditionals
4+
{% endblock %}
25
{% block extraFooter %}
36
<script src="../static/js/conditional.js"></script>
47
{% endblock %}

conditional/templates/dashboard.html

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
{% extends "nav.html" %}
2-
2+
{% block title %}
3+
Dashboard
4+
{% endblock %}
35
{% block body %}
46
<div class="container main">
57
<div class="panel panel-default">
68
<div class="panel-body dashboard-user">
79
<div class="row">
8-
<div class="col-md-2 col-sm-3 col-xs-12 vcenter">
10+
<div class="col-md-2 col-sm-3 col-xs-12 vcenter profile-container">
911
<img class="profile-image" src="https://profiles.csh.rit.edu/image/{{username}}">
1012
</div>
11-
<div class="col-xs-12 col-sm-9 col-md-9 vcenter" style="padding-bottom:10px">
12-
<h2 class="username">{{name}}</h2>
13+
<div class="col-xs-12 col-sm-9 col-md-9 vcenter profile-container">
14+
<h3 class="username">{{name}}</h3>
1315
<h5 class="email">{{username}}@csh.rit.edu</h5>
1416
<div class="profile-badges">
1517
{% if active %}
@@ -57,7 +59,7 @@ <h3 class="panel-title">Freshman Evaluations
5759
</td>
5860
</tr>
5961
<tr>
60-
<td class="title">Committee Meetings</td>
62+
<td class="title">Directorship Meetings</td>
6163
<td><span class="pull-right">
6264
{% if freshman['committee_meetings'] >= 10 %}
6365
<span class="glyphicon glyphicon-ok-sign green"></span> {% else %}
@@ -109,7 +111,7 @@ <h3 class="panel-title">Freshman Evaluations
109111

110112
<div class="panel panel-default">
111113
<div class="panel-heading">
112-
<h3 class="panel-title">Spring Evaluations
114+
<h3 class="panel-title">Membership Evaluations
113115
{% if spring['status'] == "Passed" %}
114116
<span class="pull-right"><span class="glyphicon glyphicon-ok-sign green"></span> Passed</span>
115117
{% elif spring['status'] == "Failed" %}
@@ -123,7 +125,7 @@ <h3 class="panel-title">Spring Evaluations
123125
<table class="table table-striped table-responsive no-bottom-margin">
124126
<tbody>
125127
<tr>
126-
<td class="title">Committee Meetings</td>
128+
<td class="title">Directorship Meetings</td>
127129
<td><span class="pull-right">
128130
{% if spring['committee_meetings'] >= 25 %}
129131
<span class="glyphicon glyphicon-ok-sign green"></span> {% else %}
@@ -240,7 +242,7 @@ <h3 class="panel-title">Housing Status</h3>
240242
</tr>
241243
<tr>
242244
<td class="title">Housing Queue Position</td>
243-
<td><span class="pull-right">{{housing['queue_pos']}} / {{housing['queue_len']}}</span></td>
245+
<td><span class="pull-right">{{housing['queue_pos']}}</span></td>
244246
</tr>
245247
</tbody>
246248
</table>
@@ -277,11 +279,11 @@ <h3 class="panel-title">Missed House Meetings</h3>
277279
{% endif %}
278280

279281
{% if cm_attendance_len == 0 %}
280-
<div class="alert alert-warning"><span class="glyphicon glyphicon-exclamation-sign white" style="padding-right:5px"></span> You have not attended any committee meetings.</div>
282+
<div class="alert alert-warning"><span class="glyphicon glyphicon-exclamation-sign white" style="padding-right:5px"></span> You have not attended any directorship meetings.</div>
281283
{% else %}
282284
<div class="panel panel-default">
283285
<div class="panel-heading">
284-
<h3 class="panel-title">Committee Meeting Attendance</h3>
286+
<h3 class="panel-title">Directorship Meeting Attendance</h3>
285287
</div>
286288

287289
<div class="panel-body table-fill">

conditional/templates/financial.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
{% extends "nav.html" %}
2+
{% block title %}
3+
Financial
4+
{% endblock %}
25
{% block body %}
36
<div class="container main">
47
<div class="panel panel-default">

conditional/templates/housing.html

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
{% extends "nav.html" %} {% block body %}
1+
{% extends "nav.html" %}
2+
{% block title %}
3+
Housing
4+
{% endblock %}
5+
{% block body %}
26
<div class="container main">
37
<div class="row">
48
<div class="col-xs-12 col-sm-6 col-md-6">

0 commit comments

Comments
 (0)