Skip to content

Add a CCE Minor Note feature attached to the Notes section in the User profile - #1737

Open
munsakad wants to merge 24 commits into
developmentfrom
dee_and_bright_CCE_Minor_Note_feature
Open

Add a CCE Minor Note feature attached to the Notes section in the User profile#1737
munsakad wants to merge 24 commits into
developmentfrom
dee_and_bright_CCE_Minor_Note_feature

Conversation

@munsakad

Copy link
Copy Markdown
Contributor

Issue Description

Fixes issue #1405

  • The user profile Notes section had no way to flag a note as related to the CCE Minor, even though the profile already tracks CCE Minor interest. This adds a "CCE Minor" note tag alongside the existing Bonner tag.

Changes

  • Added a "Related to CCE Minor" toggle to the Add Note modal, shown only when the user has a CCE Minor interest (volunteer.minorInterest).
    -Display a "CCE Minor" prefix in the note's Visible To column, mirroring the existing Bonner prefix convention.
    -Pass the flag through the Edit button via a data-cceminor attribute so the modal can pre-fill it.
    -All changes are confined to app/templates/main/userProfile.html.

Testing

Open a profile for a user with CCE Minor interest and click Add Note, confirm that the "Related to CCE Minor" toggle appears.
For a user without CCE Minor interest, confirm the toggle is hidden.
Verify a note flagged as CCE Minor shows the "CCE Minor" prefix in the Visible To column.
Confirm that the Bonner toggle and existing note behavior are unchanged.

@DanielRukwasha

Copy link
Copy Markdown
Contributor

Overall Impression

The feature makes sense and the approach of mirroring Bonner tag behavior is a smart, consistent design decision.
However,

The template references row.isCCEMinorNote and submits a cceMinor form field, but there are no backend changes in this
My question will be

  • Does the Note model already have an isCCEMinorNote field? If not, this will silently fail (Jinja will render it as
    False/empty with no error).
  • Is there a route handler that reads the cceMinor POST parameter and saves it?
    e

DanielRukwasha

This comment was marked as resolved.

@MImran2002 MImran2002 left a comment

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.

These are the changes or the bugs that I encounter:
Fix 1: I think this issue alone should not be solved with a HTML. This is broader because this could potentially include javascript and python. (Hint: look at how bonner notes work)

Fix 2: Because the code only holds html I am not seeing any cce minor flags from my side:
(These three notes are created by toggling cceminor)

Image

Fix 3: When I toggle the CCEminor and save the note, just like the bonner if i were to create a bonner note and go back and look i will see the model has bonner note toggle
bonner example:

Image

cceminor:

Image

if its cceminor the toggle should be toggled to show it is working.

Fix 4: In an instance where both the bonner and cce minor are toggle the bonner notes accordion seems to overwrite the cceminor notes and the note only appear in bonner this scenario should be considered as in should the note that have both toggles need to appear on both or one of them.

@MImran2002

Copy link
Copy Markdown
Contributor

@munsakad and @brightfietsop-ux after the department issue you guys worked on, while waiting for that issue to be reviewed and merged. Worked on this as we don't want this to be dragged into the weeks ahead.

@brightfietsop-ux

Copy link
Copy Markdown

What i discovered before coding

  • Curently when a note was added without a toggle, the note gets saved.
  • When the note is added with toggle related to CCE minor, the note gets saved, when you try to edit, the toggle doesn’t display that it was toggled in the first place
  • when the note is added by toggling, related to bonner, it does not even gets saved in the first place, which is the same thing when both gets toggled.

Summary

This PR adds support for marking profile notes as CCE Minor notes alongside the existing Bonner note option.

Changes

  • Added isCCEMinorNote to the ProfileNote model.
  • Added a CCE Minor toggle to the Add/Edit Note modal.
  • Updated the profile note routes and logic to save and edit the CCE Minor value.
  • Updated the JavaScript to restore the Bonner and CCE Minor toggles when editing a note.
  • Updated the Notes table to display the correct note visibility.
  • Updated the database reset process so databases restored from prod-backup.sql include the new isCCEMinorNote column.
  • Preserved the existing behavior where Bonner notes are visible to Bonner Scholars.

Testing

Tested the following note combinations:

  • Regular profile note
  • Bonner note
  • CCE Minor note
  • Note marked as both Bonner and CCE Minor
  • Editing an existing note and restoring its toggle values
  • Deleting a note
  • Resetting the database using:
    • database/reset_database.sh test
    • database/reset_database.sh from-backup

Verified in MySQL that:

  • isBonnerNote saves as 0 or 1
  • isCCEMinorNote saves as 0 or 1
  • Note content, creator, visibility, and creation date are saved correctly

Comment thread app/controllers/main/routes.py Outdated
if not noteTextbox:
return "Note cannot be empty", 400

addProfileNote(

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This does not handle a failed note insert. For example, if the user doesn't exist (e.g., postData["username"] isn't a real user), this function fails, and the route fails. Handle the failure using try: except:.

The logic function should raise and the route function should try/except.

Comment thread app/controllers/main/routes.py Outdated
Comment on lines +402 to +406
profileNoteID = request.form.get("id")
noteTextbox = request.form.get("noteTextbox", "").strip()
visibility = request.form.get("visibility", 1)
bonner = request.form.get("bonner") == "yes"
cceMinor = request.form.get("cceMinor") == "yes"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Both this and the one above can be a single function that reforms the request data. use (optional?) input parameters to handle the slight differences.

Comment thread app/logic/users.py Outdated
Comment on lines +128 to +133
visibility,
bonner,
cceMinor,
noteTextbox,
username,
):

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

make a single line since it is a function definition (not a dictionary or some other datatype)

Comment thread app/static/js/userProfile.js Outdated
Comment thread app/static/js/userProfile.js
Comment thread database/reset_database.sh Outdated
Comment on lines +45 to +47
mysql -u root -proot -NBe "SELECT COUNT(*) FROM information_schema.COLUMNS WHERE TABLE_SCHEMA='celts' AND TABLE_NAME='profilenote' AND COLUMN_NAME='isCCEMinorNote';" |
grep -q '^1$' ||
mysql -u root -proot celts -e "ALTER TABLE profilenote ADD COLUMN isCCEMinorNote TINYINT(1) NOT NULL DEFAULT 0 AFTER isBonnerNote;"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Remove this from the PR, should not be here. For local testing only .

@brightfietsop-ux
brightfietsop-ux removed the request for review from BhushanSah August 4, 2026 15:28
Comment thread app/controllers/main/routes.py Outdated
Comment thread app/controllers/main/routes.py Outdated
Comment thread app/controllers/main/routes.py Outdated
Comment thread app/logic/users.py Outdated
@MImran2002

Copy link
Copy Markdown
Contributor

Also your is only for the test data if you want to use the production data before after ./database/run_database.sh from-backup , you should log into mysql and enter ALTER TABLE profilenote
ADD COLUMN isCCEMinorNote BOOLEAN NOT NULL DEFAULT FALSE; then flask run to use on production data

@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown

View Code Coverage

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants