Skip to content

Comments

Sheffield | 25-SDC-Nov | Hassan Osman | Sprint 1 | Bug Report: Extra long blooms?#147

Open
HassanOHOsman wants to merge 9 commits intoCodeYourFuture:mainfrom
HassanOHOsman:bugfix/bloom-over-280-characters
Open

Sheffield | 25-SDC-Nov | Hassan Osman | Sprint 1 | Bug Report: Extra long blooms?#147
HassanOHOsman wants to merge 9 commits intoCodeYourFuture:mainfrom
HassanOHOsman:bugfix/bloom-over-280-characters

Conversation

@HassanOHOsman
Copy link

Self checklist

  • I have titled my PR with Region | Cohort | FirstName LastName | Sprint | Assignment Title
  • My changes meet the requirements of the task
  • I have tested my changes
  • My changes follow the style guide

This PR fixes AS's extra long bloom bug by ensuring it respects the 280-character limit. Changes include:

  1. Trim bloom content on submission: Users cannot post blooms longer than 280 characters.
  2. Trim bloom content when rendering: Any existing or backend-provided blooms are capped at 280 characters in the UI

@HassanOHOsman HassanOHOsman added ⚙️ bug Something isn't working Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. 📅 Sprint 1 Assigned during Sprint 1 of this module labels Feb 17, 2026
Copy link

@OracPrime OracPrime left a comment

Choose a reason for hiding this comment

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

Convince me of your approach (good luck!) or make it fail not trim!

const originalText = submitButton.textContent;
const textarea = form.querySelector("textarea");
const content = textarea.value.trim();
const content = textarea.value.trim().slice(0, 280);

Choose a reason for hiding this comment

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

I'm not convinced. Should too long a bloom fail, or should you truncate it and accept it? I think it should fail.

Copy link
Author

Choose a reason for hiding this comment

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

To be honest, at the time I was in two minds whether or not to handle the too long bloom with an error which lead to it not being submitted. However, somehow eventually I resorted to chopping the extra characters. I perhaps thought this approach would me more ideal since it's already published bloom.

I understand now I have to fail it altogether. I will working on it. Thank you.

@github-project-automation github-project-automation bot moved this from Backlog to In Progress in Purple Forest Kanban Feb 19, 2026
@OracPrime OracPrime added Reviewed Volunteer to add when completing a review with trainee action still to take. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Feb 19, 2026
@HassanOHOsman HassanOHOsman added Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. ⚙️ bug Something isn't working and removed ⚙️ bug Something isn't working Reviewed Volunteer to add when completing a review with trainee action still to take. labels Feb 20, 2026
@HassanOHOsman
Copy link
Author

AS bloom - the one over 280 character is now hidden. Not sure if it's the ideal approach but I did use the bloom id from the error message showed up on my browser and used it to skip over the culprit bloom when blooms are being fetched.

@HassanOHOsman
Copy link
Author

I understand very well that, ideally, there should've been a condition that'd check if a bloom was over 280 characters and if so it'd be skipped over. Having said that this just didn't work for some reason when i did it.

@HassanOHOsman
Copy link
Author

UPDATE: Well, it has worked now - I replaced the bloom ID-based logic to a conditional logic that checks if bloom is over 280 char and skips over it if that's the case. I had to disconnect from all ports and reconnect again.

@OracPrime OracPrime added the Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. label Feb 21, 2026
Copy link

@OracPrime OracPrime left a comment

Choose a reason for hiding this comment

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

You seem to be prevent overlong blooms being displayed when reading them back from the database. This is the wrong time to be doing it. You need to prevent overlong blooms being added.

I'm also concerned that your code refers to a non-existent function. Have you tested this?


def get_bloom(bloom_id: int) -> Optional[Bloom]:
with db_cursor() as cur:
with db_get_bloomcursor() as cur:

Choose a reason for hiding this comment

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

This function doesn't exist does it?

Copy link
Author

Choose a reason for hiding this comment

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

I have not implemented unit tests. However, i have manually tested what i did through the browser. Everything seemed fine, the culprit bloom wasn't/isn't displayed (which - I now know - is not the right way to do it), clicked on different buttons, sent a bloom so basically did different operations and no error messages showed up whatsoever in the console. I've attached screenshots for reference.

As for the non-existent function, I can't recall how that happen but I got it to how it was.

Screenshot 2026-02-21 at 20 13 56 Screenshot 2026-02-21 at 20 13 05

@OracPrime OracPrime added Reviewed Volunteer to add when completing a review with trainee action still to take. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. labels Feb 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

⚙️ bug Something isn't working Reviewed Volunteer to add when completing a review with trainee action still to take. 📅 Sprint 1 Assigned during Sprint 1 of this module

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

2 participants