Skip to content

Commit

Permalink
Start of tag skills, more backend updates
Browse files Browse the repository at this point in the history
  • Loading branch information
Mobmaker55 committed Sep 14, 2024
1 parent d497097 commit 9d87795
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 18 deletions.
29 changes: 20 additions & 9 deletions conditional/blueprints/major_project_submission.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,27 +92,38 @@ def submit_major_project(user_dict=None):
post_data = request.get_json()
name = post_data['projectName']
description = post_data['projectDescription']
user_id = user_dict['username']

if name == "" or len(description.strip().split()) < 50: # check for 50 word minimum
return jsonify({"success": False}), 400
project = MajorProject(user_dict['username'], name, description)
project = MajorProject(user_id, name, description)

db.session.add(project)
db.session.commit()

# This allows us to get a project with a database ID
project = MajorProject.query.filter(
MajorProject.name == name and MajorProject.uid == user_id
).first()

if project is None:
return jsonify({"success": False}), 500

# Don't send slack ping until after we are sure the DB worked fine
send_slack_ping({"text":f"<!subteam^S5XENJJAH> *{get_member_name(user_id)}* ({user_id})"
f" submitted their major project, *{name}*!"})

# Acquire S3 Bucket instance
s3 = boto3.resource("s3", endpoint_url="https://s3.csh.rit.edu")
bucket = s3.create_bucket(Bucket="major-project-media")
# Collect all the locally cached files and put them in the bucket
for file in os.listdir(f"/tmp/{user_dict['username']}"):
filepath = f"/tmp/{user_dict['username']}/{file}"
for file in os.listdir(f"/tmp/{user_id}"):
filepath = f"/tmp/{user_id}/{file}"
print(filepath)
bucket.upload_file(filepath, f"{project.id}-{file}")
os.remove(filepath)
os.rmdir(f"/tmp/{user_dict['username']}")
os.rmdir(f"/tmp/{user_id}")

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


Expand Down
8 changes: 6 additions & 2 deletions conditional/models/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,16 +135,20 @@ class MajorProject(db.Model):
date = Column(Date, nullable=False)
uid = Column(String(32), nullable=False)
name = Column(String(64), nullable=False)
description = Column(Text)
tldr = Column(String(128), nullable=False)
time = Column(Text, nullable=False)
description = Column(Text, nullable=False)
active = Column(Boolean, nullable=False)
status = Column(Enum('Pending', 'Passed', 'Failed',
name="major_project_enum"),
nullable=False)

def __init__(self, uid, name, desc):
def __init__(self, uid, name, tldr, time, desc):
self.uid = uid
self.date = datetime.now()
self.name = name
self.tldr = tldr
self.time = time
self.description = desc
self.status = 'Pending'
self.active = True
Expand Down
17 changes: 10 additions & 7 deletions conditional/templates/major_project_submission.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,18 @@

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

0 comments on commit 9d87795

Please sign in to comment.