Skip to content

Commit 9d87795

Browse files
committed
Start of tag skills, more backend updates
1 parent d497097 commit 9d87795

File tree

3 files changed

+36
-18
lines changed

3 files changed

+36
-18
lines changed

conditional/blueprints/major_project_submission.py

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -92,27 +92,38 @@ def submit_major_project(user_dict=None):
9292
post_data = request.get_json()
9393
name = post_data['projectName']
9494
description = post_data['projectDescription']
95+
user_id = user_dict['username']
9596

9697
if name == "" or len(description.strip().split()) < 50: # check for 50 word minimum
9798
return jsonify({"success": False}), 400
98-
project = MajorProject(user_dict['username'], name, description)
99+
project = MajorProject(user_id, name, description)
100+
101+
db.session.add(project)
102+
db.session.commit()
103+
104+
# This allows us to get a project with a database ID
105+
project = MajorProject.query.filter(
106+
MajorProject.name == name and MajorProject.uid == user_id
107+
).first()
108+
109+
if project is None:
110+
return jsonify({"success": False}), 500
111+
112+
# Don't send slack ping until after we are sure the DB worked fine
113+
send_slack_ping({"text":f"<!subteam^S5XENJJAH> *{get_member_name(user_id)}* ({user_id})"
114+
f" submitted their major project, *{name}*!"})
99115

100116
# Acquire S3 Bucket instance
101117
s3 = boto3.resource("s3", endpoint_url="https://s3.csh.rit.edu")
102118
bucket = s3.create_bucket(Bucket="major-project-media")
103119
# Collect all the locally cached files and put them in the bucket
104-
for file in os.listdir(f"/tmp/{user_dict['username']}"):
105-
filepath = f"/tmp/{user_dict['username']}/{file}"
120+
for file in os.listdir(f"/tmp/{user_id}"):
121+
filepath = f"/tmp/{user_id}/{file}"
106122
print(filepath)
107123
bucket.upload_file(filepath, f"{project.id}-{file}")
108124
os.remove(filepath)
109-
os.rmdir(f"/tmp/{user_dict['username']}")
125+
os.rmdir(f"/tmp/{user_id}")
110126

111-
username = user_dict['username']
112-
send_slack_ping({"text":f"<!subteam^S5XENJJAH> *{get_member_name(username)}* ({username})"
113-
f" submitted their major project, *{name}*!"})
114-
db.session.add(project)
115-
db.session.commit()
116127
return jsonify({"success": True}), 200
117128

118129

conditional/models/models.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,16 +135,20 @@ class MajorProject(db.Model):
135135
date = Column(Date, nullable=False)
136136
uid = Column(String(32), nullable=False)
137137
name = Column(String(64), nullable=False)
138-
description = Column(Text)
138+
tldr = Column(String(128), nullable=False)
139+
time = Column(Text, nullable=False)
140+
description = Column(Text, nullable=False)
139141
active = Column(Boolean, nullable=False)
140142
status = Column(Enum('Pending', 'Passed', 'Failed',
141143
name="major_project_enum"),
142144
nullable=False)
143145

144-
def __init__(self, uid, name, desc):
146+
def __init__(self, uid, name, tldr, time, desc):
145147
self.uid = uid
146148
self.date = datetime.now()
147149
self.name = name
150+
self.tldr = tldr
151+
self.time = time
148152
self.description = desc
149153
self.status = 'Pending'
150154
self.active = True

conditional/templates/major_project_submission.html

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,18 @@
99

1010
<div class="container main">
1111
<h3 class="page-title">Major Project Form</h3>
12-
<!--TODO: put a box explaining major project -->
1312
<div class="panel panel-default">
1413
<div class="panel-body">
1514
<p class="lead">Welcome to the Major Project submission form! We're excited to read about what you've
1615
been working on. For us (E-Board) to best evaluate your project, please give us as much detail as
1716
possible. Don't feel pressured to write full paragraphs though, good bullet points are plenty!
18-
<br>Generally, major projects are most likely to pass when they meet at least 3 of the 4
17+
<br>Generally, a major project is something that you make with the goal of challenging yourself,
18+
learning new things, and doing something you would be proud of. Major projects are most likely to
19+
pass when they meet at least 2 of the 3
1920
<a href="https://wiki.csh.rit.edu/wiki/Major_Project_Pillars">Major Project Pillars</a> -
20-
considerable time on your project, benefiting House, learning new things, and applying hard
21-
skills. And of course, after you submit, please try to talk to E-Board members (in-person or over
22-
Slack) so we are familiar with your project and can ask you questions!</p>
21+
considerable time on your project, benefiting House, and meaningfully applying skills. And of course,
22+
after you submit, please try to talk to E-Board members (in-person or over Slack) so we are familiar
23+
with your project and can ask you questions!</p>
2324
</div>
2425
</div>
2526
<form data-module="majorProjectForm">
@@ -34,9 +35,11 @@ <h3 class="page-title">Major Project Form</h3>
3435
<div class="row">
3536
<div class="col-lg-6">
3637
<label class="form-label" for="skills-applied">Skills Applied</label>
37-
<textarea id="skills-applied" name="skills-applied" class="form-control form-textarea"
38+
<div id="skills-applied" class="form-control form-textarea">
39+
List what skills you meaningfully used while working on this project (at least 2!)</div>
40+
<textarea id="skills-applied-old" name="skills-applied" class="form-control form-textarea"
3841
rows="5"
39-
placeholder="List what skills you used for this project (at least 2!), similar to what you'd put on a resume."></textarea>
42+
placeholder="List what skills you meaningfully used while working on this project (at least 2!)"><span>Test</span></textarea>
4043
</div>
4144
<div class="col-lg-6">
4245
<label class="form-label" for="time-commitment">Time Commitment</label>

0 commit comments

Comments
 (0)