Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ If the database schema is changed after initializing the database, you must migr

```sh
flask db upgrade
# or, to run it inside the container for use with local databases (DO THIS
# or, to run it inside the container for use with local databases (DO THIS)
podman exec conditional flask db upgrade
```

Expand All @@ -150,10 +150,18 @@ At the same time, if you change the database schema, you must generate a new mig

```sh
flask db migrate
# or, to run it inside the container for use with local databases (DO THIS
# or, to run it inside the container for use with local databases (DO THIS)
podman exec conditional flask db migrate
```

If the migration doesn't get created you can also try

```sh
flask db revision --message "MESSAGE"
# or, to run it inside the container for use with local databases (DO THIS)
podman exec conditional flask db revision --message "MESSAGE"
```

The new migration script in `migrations/versions` should be verified before being committed, as Alembic may not detect every change you make to the models.

For more information, refer to the [Flask-Migrate](https://flask-migrate.readthedocs.io/) documentation.
Expand Down
6 changes: 4 additions & 2 deletions conditional/blueprints/major_project_submission.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ def display_major_project(user_dict=None):
"username": p.uid,
"name": ldap_get_member(p.uid).cn,
"proj_name": p.name,
"ai_usage": p.ai_usage,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is crashing, you need to edit conditional/utils/major_project.py to include ai usage i believe

"tldr": p.tldr,
"time_spent": p.time_spent,
"skills": p.skills,
Expand Down Expand Up @@ -106,6 +107,7 @@ def submit_major_project(user_dict=None):

name = post_data["projectName"]
tldr = post_data['projectTldr']
ai_usage = post_data['projectAIUsage']
time_spent = post_data['projectTimeSpent']
skills = post_data['projectSkills']
description = post_data["projectDescription"]
Expand All @@ -116,10 +118,10 @@ def submit_major_project(user_dict=None):
log.info(user_id)

# All fields are required in order to be able to submit the form
if not name or not tldr or not time_spent or not description:
if not name or not tldr or not ai_usage or not time_spent or not description:
return jsonify({"success": False}), 400

project: MajorProject = MajorProject(user_id, name, tldr, time_spent, description, links)
project: MajorProject = MajorProject(user_id, name, tldr, ai_usage, time_spent, description, links)

# Save the info to the database
db.session.add(project)
Expand Down
4 changes: 3 additions & 1 deletion conditional/models/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ class MajorProject(db.Model):
uid = Column(String(32), nullable=False, index=True)
name = Column(String(64), nullable=False)
tldr = Column(String(128), nullable=True)
ai_usage = Column(Text, nullable=False)
time_spent = Column(Text, nullable=True)
description = Column(Text, nullable=False)
links = Column(Text, nullable=True)
Expand All @@ -166,11 +167,12 @@ class MajorProject(db.Model):
name="major_project_enum"),
nullable=False)

def __init__(self, uid, name, tldr, time_spent, description, links): # pylint: disable=too-many-positional-arguments
def __init__(self, uid, name, tldr, ai_usage, time_spent, description, links): # pylint: disable=too-many-positional-arguments
self.uid = uid
self.date = datetime.now()
self.name = name
self.tldr = tldr
self.ai_usage = ai_usage
self.time_spent = time_spent
self.description = description
self.links = links
Expand Down
15 changes: 15 additions & 0 deletions conditional/templates/major_project_submission.html
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,21 @@ <h3 class="mb-4">Major Project Form</h3>
</small>
</div>
</div>

<div class="col-lg-6">
<label for="ai-usage" class="d-block h5 mt-4 mb-2">
AI Usage
</label>

<textarea
id="ai-usage"
name="ai-usage"
rows="4"
class="form-control mb-extra"
placeholder="AI has become a staple to the computer science field. There's no shame in saying you used AI, but be honest about how much you used AI versus how much you did."
required
></textarea>
</div>

<div class="col-lg-6">
<label for="time-commitment" class="d-block h5 mt-5 mb-2">
Expand Down
38 changes: 20 additions & 18 deletions conditional/util/major_project.py
Original file line number Diff line number Diff line change
@@ -1,26 +1,28 @@
from sqlalchemy import desc, func

from conditional import db, start_of_year
from conditional.models.models import MajorProject
from conditional.models.models import MajorProjectSkill
from conditional.models.models import MajorProject, MajorProjectSkill


def get_project_list():
proj_list = db.session.query(
MajorProject.id,
MajorProject.date,
MajorProject.uid,
MajorProject.name,
MajorProject.tldr,
MajorProject.time_spent,
MajorProject.description,
MajorProject.links,
MajorProject.status,
func.array_agg(MajorProjectSkill.skill).label("skills")
).outerjoin(MajorProjectSkill,
MajorProject.id == MajorProjectSkill.project_id
).group_by(MajorProject.id
).where(MajorProject.date >= start_of_year()
).order_by(desc(MajorProject.date), desc(MajorProject.id))
proj_list = (
db.session.query(
MajorProject.id,
MajorProject.date,
MajorProject.uid,
MajorProject.name,
MajorProject.ai_usage,
MajorProject.tldr,
MajorProject.time_spent,
MajorProject.description,
MajorProject.links,
MajorProject.status,
func.array_agg(MajorProjectSkill.skill).label("skills"),
)
.outerjoin(MajorProjectSkill, MajorProject.id == MajorProjectSkill.project_id)
.group_by(MajorProject.id)
.where(MajorProject.date >= start_of_year())
.order_by(desc(MajorProject.date), desc(MajorProject.id))
)

return proj_list
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
"""AI usage input for major projects

Revision ID: 4c0f1c4e006f
Revises: ce92a683ecf8
Create Date: 2026-09-06 22:35:09.349126

"""

# revision identifiers, used by Alembic.
revision = "4c0f1c4e006f"
down_revision = "5e8db174ce30"

import sqlalchemy as sa
from alembic import op


def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column("major_projects", sa.Column("ai_usage", sa.Text(), nullable=True))
# ### end Alembic commands ###


def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_column("major_projects", "ai_usage")
# ### end Alembic commands ###
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
"""AI usage input for major projects

Revision ID: 4c0f1c4e006f
Revises: ce92a683ecf8
Create Date: 2026-09-06 22:35:09.349126

"""

# revision identifiers, used by Alembic.
revision = "4c0f1c4e006f"
down_revision = "ce92a683ecf8"
Comment on lines +3 to +11

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're going to hate me, but because I hotfixed the stuff for account creation, this is broken, when it references ce92a683ecf8 you should change it to 5e8db174ce30


import sqlalchemy as sa
from alembic import op


def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column("major_projects", sa.Column("ai_usage", sa.Text(), nullable=True))
# ### end Alembic commands ###


def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_column("major_projects", "ai_usage")
# ### end Alembic commands ###
Loading