Skip to content

London | 26-SDC-July | Raihan Sharif | Sprint 2 | rebloom - #321

Open
RaihanSharif wants to merge 32 commits into
CodeYourFuture:mainfrom
RaihanSharif:feature/rebloom
Open

RaihanSharif wants to merge 32 commits into
CodeYourFuture:mainfrom
RaihanSharif:feature/rebloom

Conversation

@RaihanSharif

Copy link
Copy Markdown

Learners, PR Template

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

Task code

CYF-1171

Changelist

Blooms have a rebloom button, and rebloom count.

Users can "rebloom" a bloom they haven't already rebloomed.

On reblooming:

the rebloom gets added to the user's timeline, and their profile timeline.
reblooms by followed users also gets added to the home timeline.
reblooms done by currently logged in user are green.
reblooms by other users are in purple.
all reblooms are non-rebloomable. You must go to the original to rebloom.

Fetches blooms on navigation to a page, as stale cache was an issue.

initial implementation of how reblooms will be recorded.

A rebloom refers to a bloom, and rebloomer.

Get rebloom count by number of rows for a given bloom id in reblooms table.
By combining the blooms and reblooms, the home_timeline, other_profile endpoints don't have to change much.
The before clause now uses WHERE because it's filtering the combined blooms/reblooms.

Use correct placeholder for username
add a helper function to get reblooms by a user from a given list of blooms.
Previously going to profile would keep stale bloom data, and only purging the localStorage would fix it.
@RaihanSharif RaihanSharif added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Oct 22, 2026

@iscmiguelsamaniego iscmiguelsamaniego left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Solid, modular Rebloom feature! Just clean up the duplicate returns in Python, wrap your rebloom button states in try...finally, add .catch() error handling to routing fetches, and round out your .gitignore with Python/Node exclusions.

Comment thread backend/data/blooms.py

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Great progress on the reblooms implementation! Here are two quick questions to help refine the code:

  1. Duplicate returns: In functions like home_timeline, user_blooms, and hashtag, did you notice consecutive return statements? How might that affect whether _mark_rebloomed_by_me gets executed?
  2. Query performance: By using subqueries to count reblooms for every row in the main queries, how do you think the database performance will scale as the dataset grows?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

On the first question, I'm not quite sure what you're hinting at. Looking at those three functions again, it doesn't look like there's are consecutive return statements.

Comment thread backend/endpoints.py

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Great, Here are a couple of quick questions to help refine it:

  1. Unreachable Code: In functions like home_timeline, user_blooms, and hashtag, did you notice that the second return statement is placed right after the first one? How might that affect whether _mark_rebloomed_by_me is ever executed?
  2. Variable Definitions: In self_profile(), are profile_user and profile_username defined before they are used in followers and blooms.get_blooms_for_user()?

Comment thread backend/main.py

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Great routing setup! Notice the data type used for the port parameter in app.run()—might an integer be preferred there? Also, are all the imported view functions (like self_profile and register) accounted for in your URL rules?

Comment thread db/schema.sql

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Clean schema design with proper constraints and well-chosen indexes! How do you envision reblooms_bloom_id_idx and reblooms_user_ts_idx supporting your queries for timelines and rebloom counts?

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Clean component logic for rendering reblooms!

Notice how bloomFrag is queried right at the start before it's defined or cloned from the template—how might we ensure the template is properly cloned into bloomFrag before accessing its elements?

Comment thread front-end/lib/router.mjs

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Great job structuring the routing logic to cleanly distinguish between real navigation and state re-renders!

Notice how apiService.getBloom includes a .catch() for error handling—might the other profile and hashtag fetch calls also benefit from error handling to prevent unhandled rejections if a network request fails?

Comment thread front-end/index.css

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Clean styling! Just consider using a CSS variable for the green border and ensure display: flex is set on the footer.

Comment thread front-end/index.html

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Clean and well-structured HTML template! Just remove the duplicate comments and ensure you use cloneNode(true) when instantiating it.

Comment thread front-end/index.mjs

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Great event delegation! Just make sure to pass event into your state-change listener, wrap the rebloom action in a try...finally to reset the button state on error, and remove the redundant refreshRouteData() call on load.

Comment thread .gitignore

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Good start! Have you considered adding ignores for your Python (venv, __pycache__, .env) and Node (node_modules, dist) environments?

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

Labels

Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed.

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

2 participants