diff --git a/README.md b/README.md index fc01d576..3106d8c3 100644 --- a/README.md +++ b/README.md @@ -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 ``` @@ -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. diff --git a/conditional/blueprints/major_project_submission.py b/conditional/blueprints/major_project_submission.py index f847480d..42f594d9 100644 --- a/conditional/blueprints/major_project_submission.py +++ b/conditional/blueprints/major_project_submission.py @@ -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, "tldr": p.tldr, "time_spent": p.time_spent, "skills": p.skills, @@ -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"] @@ -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) diff --git a/conditional/models/models.py b/conditional/models/models.py index 604ea423..e0aad46e 100644 --- a/conditional/models/models.py +++ b/conditional/models/models.py @@ -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) @@ -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 diff --git a/conditional/templates/major_project_submission.html b/conditional/templates/major_project_submission.html index 0f73678c..9c775fe1 100644 --- a/conditional/templates/major_project_submission.html +++ b/conditional/templates/major_project_submission.html @@ -92,6 +92,21 @@