Skip to content

Commit 9cb4700

Browse files
Merge branch 'develop' into auto-housing-points
2 parents 9533e00 + 6441972 commit 9cb4700

28 files changed

+201
-296
lines changed

Dockerfile

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,37 @@
1-
FROM node:25-bookworm-slim AS build-frontend
1+
FROM node:25-trixie-slim AS build-frontend
22

3-
RUN mkdir /opt/conditional
3+
RUN mkdir /opt/conditional
44

55
WORKDIR /opt/conditional
66

7-
RUN apt-get -yq update && \
8-
apt-get -yq install curl git
9-
107
COPY package.json package-lock.json /opt/conditional/
118

12-
RUN npm ci
9+
RUN npm ci --ignore-scripts
1310

1411
COPY webpack.config.js /opt/conditional
1512
COPY frontend /opt/conditional/frontend
1613

17-
RUN npm run webpack
18-
19-
FROM docker.io/python:3.12-slim-bookworm
20-
MAINTAINER Computer Science House <webmaster@csh.rit.edu>
21-
22-
RUN mkdir /opt/conditional
14+
RUN npm run webpack
2315

24-
COPY requirements.txt /opt/conditional
16+
FROM docker.io/astral/uv:python3.13-trixie-slim
17+
LABEL maintainer="Computer Science House <webmaster@csh.rit.edu>"
2518

2619
WORKDIR /opt/conditional
2720

2821
RUN apt-get -yq update && \
29-
apt-get -yq install libsasl2-dev libldap2-dev libldap-common libssl-dev gcc g++ make && \
30-
pip install -r requirements.txt && \
31-
apt-get -yq clean all
22+
apt-get -yq --no-install-recommends install g++ gcc libldap-common libldap2-dev libsasl2-dev libssl-dev make && \
23+
apt-get -yq clean all
24+
25+
COPY requirements.txt /opt/conditional
26+
27+
RUN uv pip install --system -r requirements.txt
3228

3329
ARG PORT=8080
3430
ENV PORT=${PORT}
3531
EXPOSE ${PORT}
3632

3733
COPY conditional /opt/conditional/conditional
34+
COPY migrations /opt/conditional/migrations
3835
COPY *.py package.json /opt/conditional/
3936
COPY --from=build-frontend /opt/conditional/conditional/static/ /opt/conditional/conditional/static/
4037

conditional/blueprints/dashboard.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from flask import Blueprint, request
33

44
from conditional import start_of_year, auth
5-
from conditional.models.models import Conditional
5+
from conditional.models.models import Conditional, MajorProject
66
from conditional.models.models import HouseMeeting
77
from conditional.models.models import MemberHouseMeetingAttendance
88
from conditional.models.models import MemberSeminarAttendance
@@ -82,8 +82,6 @@ def display_dashboard(user_dict=None):
8282

8383
data['housing'] = housing
8484

85-
proj_list = get_project_list()
86-
8785
data['major_projects'] = [
8886
{
8987
"id": p.id,
@@ -94,10 +92,10 @@ def display_dashboard(user_dict=None):
9492
"time_spent": p.time_spent,
9593
"skills": p.skills,
9694
"desc": p.description,
97-
"links": list(filter(None, p.links.split("\n"))),
95+
"links": [] if p.links is None else list(filter(None, p.links.split("\n"))),
9896
"status": p.status,
9997
}
100-
for p in proj_list
98+
for p in get_project_list().filter(MajorProject.uid == uid)
10199
]
102100

103101
data['major_projects_count'] = len(data['major_projects'])

conditional/blueprints/housing.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
from conditional.util.ldap import ldap_get_roomnumber
1414
from conditional.util.ldap import ldap_is_eval_director
1515
from conditional.util.ldap import ldap_set_active
16+
from conditional.util.user_dict import user_dict_is_eval_director
1617

1718
logger = structlog.get_logger()
1819

@@ -56,7 +57,7 @@ def display_housing(user_dict=None):
5657
# return names in 'first last (username)' format
5758
return render_template('housing.html',
5859
username=user_dict['username'],
59-
queue=get_housing_queue(ldap_is_eval_director(user_dict['account'])),
60+
queue=get_housing_queue(user_dict_is_eval_director(user_dict)),
6061
housing=housing,
6162
room_list=sorted(list(room_list)))
6263

@@ -67,7 +68,7 @@ def display_housing(user_dict=None):
6768
def change_queue_state(user_dict=None):
6869
log = logger.new(request=request, auth_dict=user_dict)
6970

70-
if not ldap_is_eval_director(user_dict['account']):
71+
if not user_dict_is_eval_director(user_dict):
7172
return "must be eval director", 403
7273

7374
post_data = request.get_json()
@@ -95,7 +96,7 @@ def change_room_numbers(rmnumber, user_dict=None):
9596

9697
update = request.get_json()
9798

98-
if not ldap_is_eval_director(user_dict['account']):
99+
if not user_dict_is_eval_director(user_dict):
99100
return "must be eval director", 403
100101

101102
# Get the current list of people living on-floor.

conditional/blueprints/major_project_submission.py

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def display_major_project(user_dict=None):
5353
"time_spent": p.time_spent,
5454
"skills": p.skills,
5555
"desc": p.description,
56-
"links": list(filter(None, p.links.split("\n"))),
56+
"links": [] if p.links is None else list(filter(None, p.links.split("\n"))),
5757
"status": p.status,
5858
"is_owner": bool(user_dict["username"] == p.uid),
5959
"files": list_files_in_folder(bucket, f"{p.id}/")
@@ -65,6 +65,7 @@ def display_major_project(user_dict=None):
6565
return render_template(
6666
"major_project_submission.html",
6767
major_projects=major_projects,
68+
bucket_name=bucket,
6869
major_projects_len=len(major_projects),
6970
username=user_dict["username"])
7071

@@ -156,7 +157,9 @@ def submit_major_project(user_dict=None):
156157
for file in os.listdir(temp_dir):
157158
filepath = f"{temp_dir}/{file}"
158159

159-
s3.upload_file(filepath, 'major-project-media', f"{project.id}/{file}")
160+
s3.upload_file(filepath, app.config['S3_BUCKET_ID'], f"{project.id}/{file}", ExtraArgs={
161+
'ExpectedBucketOwner': app.config['S3_BUCKET_ID']
162+
})
160163

161164
os.remove(filepath)
162165

@@ -165,12 +168,16 @@ def submit_major_project(user_dict=None):
165168

166169

167170
# Send the slack ping only after we know that the data was properly saved to the DB
168-
send_slack_ping(
169-
{
170-
"text": f"<!subteam^S5XENJJAH> *{get_member_name(user_id)}* ({user_id})"
171-
f" submitted their major project, *{name}*!"
172-
}
173-
)
171+
if app.config['DEV_DISABLE_SLACK_PING']:
172+
log.info("Slack ping skipped due to environment override")
173+
else:
174+
send_slack_ping(
175+
{
176+
"text": f"<!subteam^S5XENJJAH> *{get_member_name(user_id)}* ({user_id})"
177+
f" submitted their major project, *{name}*!"
178+
}
179+
)
180+
174181

175182
return jsonify({"success": True}), 200
176183

@@ -181,7 +188,7 @@ def submit_major_project(user_dict=None):
181188
def major_project_review(user_dict=None):
182189
log = logger.new(request=request, auth_dict=user_dict)
183190

184-
if not user_dict_is_eval_director(user_dict["account"]):
191+
if not user_dict_is_eval_director(user_dict):
185192
return redirect("/dashboard", code=302)
186193

187194
post_data = request.get_json()
@@ -190,7 +197,6 @@ def major_project_review(user_dict=None):
190197

191198
log.info(f"{status} Major Project ID: {pid}")
192199

193-
print(post_data)
194200
MajorProject.query.filter(MajorProject.id == pid).update({"status": status})
195201

196202
db.session.flush()

conditional/templates/attendance_hm.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ <h3 class="panel-title">Attendees</h3>
2626
<input class="form-control" type="text" placeholder="Quick Select" data-module="hmSearch" data-target="table.hm-attendance">
2727
</div>
2828
<div class="table-responsive">
29-
<table class="table table-striped no-bottom-margin hm-attendance" data-module="table" data-sort-column="0" data-sort-order="asc" data-paginated="false">
29+
<table class="table table-striped no-bottom-margin hm-attendance" data-module="table" data-order="[[ 0, &quot;asc&quot; ]]" data-paging="false">
3030
<thead>
3131
<tr>
3232
<th>Name</th>

conditional/templates/co_op_management.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ <h3 class="panel-title">Co-Op Management</h3>
1111
</div>
1212
<div class="panel-body table-fill">
1313
<div class="table-responsive">
14-
<table class="table table-striped no-bottom-margin" data-module="table" data-searchable="false" data-sort-column="1" data-sort-order="asc" data-length-changable="true" data-paginated="false">
14+
<table class="table table-striped no-bottom-margin" data-module="table" data-searchable="false" data-order="[[ 1, &quot;asc&quot; ]]" data-length-change="true" data-paging="false" data-info="true">
1515
<thead>
1616
<tr>
1717
<th>Name</th>

conditional/templates/dashboard.html

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,7 @@ <h3 class="panel-title">Directorship Meeting Attendance</h3>
462462
</div>
463463

464464
<div class="panel-body table-fill">
465-
<table class="table table-striped table-responsive no-bottom-margin" data-module="table">
465+
<table class="table table-striped table-responsive" data-module="table" data-length-change="false" data-searching="false">
466466
<thead>
467467
<tr>
468468
<th>Event</th>
@@ -478,7 +478,6 @@ <h3 class="panel-title">Directorship Meeting Attendance</h3>
478478
{% endfor %}
479479
</tbody>
480480
</table>
481-
<dir-pagination-controls class="panel-inner-padding"></dir-pagination-controls>
482481
</div>
483482
</div>
484483
{% endif %}

conditional/templates/gatekeep.html

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -126,10 +126,9 @@ <h4>Missed House Meetings</h4>
126126
</div>
127127
<div id="eval-table" style="display:none;">
128128
<div class="panel panel-default">
129-
<div class="panel-body table-fill">
130129
<div class="panel-body table-fill">
131130
<div class="table-responsive">
132-
<table class="table table-striped no-bottom-margin" data-module="table" data-searchable="true" data-sort-column="4" data-sort-order="asc" data-length-changable="true" data-paginated="false">
131+
<table class="table table-striped" data-module="table" data-order="[[ 4, &quot;asc&quot; ]]" data-length-change="true" data-paging="false" data-info="false">
133132
<thead>
134133
<tr>
135134
<th>Name</th>
@@ -161,14 +160,14 @@ <h4>Missed House Meetings</h4>
161160
<i class="bi bi-check-circle-fill green eval-info-status"></i> {{m['committee_meetings']}} / {{ req_meetings }}
162161
{% endif %}
163162
</td>
164-
<td>
163+
<td data-sort="{{ m['technical_seminars'] }}">
165164
{% if m['technical_seminars'] < req_seminars %}
166165
<i class="bi bi-x-circle-fill red eval-info-status"></i> {{ m['technical_seminars'] }} / {{ req_seminars }}
167166
{% else %}
168167
<i class="bi bi-check-circle-fill green eval-info-status"></i> {{ m['technical_seminars'] }} / {{ req_seminars }}
169168
{% endif %}
170169
</td>
171-
<td data-sort="{{ m['house_meetings_missed']|length }}">
170+
<td data-sort="{{ m['house_meetings_missed']|length }}">
172171
{% if m['house_meetings_missed']|length <= 1 %}
173172
<i class="bi bi-check-circle-fill green eval-info-status"></i> {{m['house_meetings_missed']|length}}
174173
{% else %}
@@ -181,7 +180,6 @@ <h4>Missed House Meetings</h4>
181180
</table>
182181
</div>
183182
</div>
184-
</div>
185183
</div>
186184
</div>
187185
</div>

conditional/templates/housing.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ <h3 class="panel-title">Housing Queue
1818
</div>
1919
<div class="panel-body table-fill">
2020
<div class="table-responsive">
21-
<table class="table table-striped no-bottom-margin" data-module="table" data-paginated="false" data-ordering="false"{% if is_eval_director %} data-searchable="true" data-show="all"{% endif %}>
21+
<table class="table table-striped no-bottom-margin" data-module="table" data-paging="false" data-ordering="false"{% if is_eval_director %} data-search="true" data-show="all"{% endif %}>
2222
<thead>
2323
<tr>
2424
<th>Member</th>

conditional/templates/intro_evals.html

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -174,18 +174,17 @@ <h4>Other Comments</h4>
174174

175175
<div id="eval-table" style="display:none;">
176176
<div class="panel panel-default">
177-
<div class="panel-body table-fill">
178177
<div class="panel-body table-fill">
179178
<div class="table-responsive">
180-
<table class="table table-striped no-bottom-margin" data-module="table" data-searchable="true" data-sort-column="3" data-sort-order="asc" data-length-changable="true" data-paginated="false">
179+
<table class="table table-striped" data-module="table" data-order="[[ 4, &quot;asc&quot; ]]" data-sort-order="asc" data-length-change="true" data-paging="false" data-info="false">
181180
<thead>
182181
<tr>
183182
<th>Name</th>
184183
<th>Result</th>
185184
<th>Meetings</th>
186185
<th>Signatures Missed</th>
187186
<th>Technical Seminars</th>
188-
<th>House Meetings Missed</th>
187+
<th>House Meetings Missed</th>
189188
</tr>
190189
</thead>
191190
<tbody>
@@ -239,7 +238,6 @@ <h4>Other Comments</h4>
239238
</table>
240239
</div>
241240
</div>
242-
</div>
243241
</div>
244242
</div>
245243
</div>

0 commit comments

Comments
 (0)