Skip to content

Feat/28 mini algo - #48

Merged
Wesley-Fos merged 20 commits into
mainfrom
feat/28-Mini-Algo
Nov 12, 2026
Merged

Wesley-Fos merged 20 commits into
mainfrom
feat/28-Mini-Algo

Conversation

@Wesley-Fos

@Wesley-Fos Wesley-Fos commented Oct 30, 2026 •

Copy link
Copy Markdown
Collaborator

Describe your changes

Mini algorithm for determining if a sticker can be added to a staging area.

Issue/Story ticket number and link

#28

Checklist before requesting a review

  • [ x] I have performed a self-review of my code.
  • [ x] I have fulfilled all acceptance criteria.
  • [ x] All Tasks have been completed OR notes have been made on the ticket.
  • [ x] The solution builds.
  • [ x] 100% of tests pass with 80% code coverage from unit tests.
  • [ x] Documentation has been updated.

@Wesley-Fos Wesley-Fos self-assigned this Oct 30, 2026
@Wesley-Fos Wesley-Fos added feature New feature or request algorithm labels Oct 30, 2026
Comment thread frontend/src/mini-algo.ts Resolved

@or8655 or8655 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.

This looks great! I have three suggestions:

  1. Our model tier UML class diagram depicts stickers having height and width, not an area. Your algorithm should use the sticker's height and width to calculate its area.
  2. The algorithm should account for individual stickers and not group them together. The current algorithm takes each sticker and multiplies its area by the quantity present in the staging area. If that sticker gets examined during the algorithm, the area freed by removing it would be the equivalent of the area freed by removing all quantities of the sticker, not just one. Due to time constraints, I think this is acceptable, but it should be noted as an intentional design choice so that we don't forget and future developers understand why the algorithm does this.
  3. In the future, when you write complicated code, please include inline comments to explain your thought process behind the code. It makes it easier for reviewers to understand what your code is doing, and helps future developers understand and contribute to your code.

Comment thread frontend/src/mini-algo.ts
const stickerArea = stickerToAdd.sticker.height * stickerToAdd.sticker.width * stickerToAdd.quantity;

// sticker cannot fit in area capacity?
if (stickerArea > STAGING_AREA_CAPACITY) {

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.

Not an issue for this ticket, but this is a good reminder that we need to think about how to handle sellers wanting to post stickers that can't fit alone on a half sheet

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.

Good point

Comment thread frontend/src/mini-algo.test.ts Resolved
Comment thread frontend/src/mini-algo.test.ts Resolved
Comment thread frontend/src/mini-algo.ts Outdated
const selected: typeof candidates = [];

// Recursive function to find a list of options to remove from the stickers in the staging area.
function collectOptions(startIndex: number, freedArea: number): void {

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.

I strongly suggest adding back the comments that explain what the arguments to this function are. This will help future developers understand what this function does quickly.

Also, why not move the function outside of the loop?

@or8655

or8655 commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

My only suggestion is the one I commented above. I think this PR is ready to be merged.

Wesley-Fos and others added 3 commits November 12, 2026 10:10
* build(deps-dev): bump vite from 8.3.2 to 8.3.5 in /frontend (#44)

Bumps [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) from 8.3.2 to 8.3.5.
- [Release notes](https://github.com/vitejs/vite/releases)
- [Changelog](https://github.com/vitejs/vite/blob/main/packages/vite/CHANGELOG.md)
- [Commits](https://github.com/vitejs/vite/commits/v8.3.5/packages/vite)

---
updated-dependencies:
- dependency-name: vite
  dependency-version: 8.3.5
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* docs(4up): week 11 (#49)

* feat: ci/cd gh actions (#53)

* feat: ci/cd gh actions

* docs(README): Moving CI section for better flow

* ci: run frontend and backend workflows on pushes to main

---------

Co-authored-by: Wesley-Fos <wwf4167@rit.edu>
Co-authored-by: Oscar Rojas-Perez <or8655@rit.edu>

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Oscar Rojas <94993190+or8655@users.noreply.github.com>
Co-authored-by: Wesley-Fos <wwf4167@rit.edu>
Co-authored-by: Oscar Rojas-Perez <or8655@rit.edu>
* build(deps-dev): bump vite from 8.3.2 to 8.3.5 in /frontend (#44)

Bumps [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) from 8.3.2 to 8.3.5.
- [Release notes](https://github.com/vitejs/vite/releases)
- [Changelog](https://github.com/vitejs/vite/blob/main/packages/vite/CHANGELOG.md)
- [Commits](https://github.com/vitejs/vite/commits/v8.3.5/packages/vite)

---
updated-dependencies:
- dependency-name: vite
  dependency-version: 8.3.5
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* docs(4up): week 11 (#49)

* feat: ci/cd gh actions (#53)

* feat: ci/cd gh actions

* docs(README): Moving CI section for better flow

* ci: run frontend and backend workflows on pushes to main

---------

Co-authored-by: Wesley-Fos <wwf4167@rit.edu>
Co-authored-by: Oscar Rojas-Perez <or8655@rit.edu>

* feat: moving things and fixing merge conflicts

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Oscar Rojas <94993190+or8655@users.noreply.github.com>
Co-authored-by: Wesley-Fos <wwf4167@rit.edu>
Co-authored-by: Oscar Rojas-Perez <or8655@rit.edu>
@Wesley-Fos
Wesley-Fos merged commit 4183acd into main Nov 12, 2026
1 check passed
@Wesley-Fos
Wesley-Fos deleted the feat/28-Mini-Algo branch November 12, 2026 15:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

algorithm feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants