ucsb-cs156-m23 / proj-happycows-m23-10am-4

https://ucsb-cs156-m23.github.io/proj-happycows-m23-10am-4/
0 stars 1 forks source link

FEATURE: Added Capacity per User Feature #35

Closed MPriston closed 1 year ago

MPriston commented 1 year ago

Overview

In this PR we add the ability to describe a capacity per-user when creating a new common or editing it. This change introduces a new field on the create and edit commons form that gives the admin the ability to specify a per-user capacity for each commons.

It utilizes the following formula to calculate the effective capacity of the common when doing health calculations max(capacityPerUser * numUsers, carryingCapacity)

Screenshots

New Create and Update Form:

image

Effective Capacity with One User in the common

image

Effective Capacity with Two Users in the common

image

With 12 cows in the common health updating job does not diminish cow health

image

With 12 cows in the common, and one user is removed, the health updating job diminishes cow health

image

Validation (Optional)

  1. Download this branch.
  2. Run the project.
  3. Go to this page.
  4. Test this function.

Feedback Requests

The way I implemented this feature was by creating a new private and Non-serializable variable in the Commons entity, and every time a user joins or is deleted from a common the variable is updated. This was due to the fact that you can't reference repositories inside the entity in order to get the user count. If you have any suggestions on how to improve this solution that will be appreciated.

Tests

Linked Issues

Closes #3

MPriston commented 1 year ago

Currently working on the Frontend of the changes

MPriston commented 1 year ago

Currently working on some bugs

MPriston commented 1 year ago

Working on test coverage for new variables

MPriston commented 1 year ago

Test Coverage is good, need to update, jobs notifications to display correct information