Skip to content

Implemented New Sustainability Score Calculation and Fixed Bugs When Renting Items #73

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 14 commits into
base: master
Choose a base branch
from

Conversation

PFGrande
Copy link
Collaborator

@PFGrande PFGrande commented Dec 8, 2024

Pull Request Title

Implemented New Sustainability Score Calculation and Fixed Bugs When Renting Items

Description

  • Modified item model's API to parse dates, and attempted to fix post requests sending it data for fields it does not have. My attempt was unsuccessful but extra fields do not cause crashes or other bugs
  • Created a utils directory to hold the categories.py file. This file holds functions that help compute the different areas of the sustainability score. The file was created to avoid circular dependencies at compile time.
  • A user's sustainability score is computed based on 4 different areas:
    • days on the platform (out of two years) - 30%
    • items rented from other users - 25%
    • items listed by the user (also referred to as items rented out) - 30%
    • listed items other users are actively renting from the user (also referred to as popularity) - 15%
    • each of these areas have their own "maximum points" which can be modified as we collect more data from users
      to better balance the distribution of the Sustainability Score.
  • Modified items/id/page.tsx to render the discount and discounted total price (fixed bug where page rendered more than 2 decimal places)

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

  • Computing the Sustainability Score: In the seller_detail() function within the useraccount/api.py file, I temporarily added a line to compute the current Sustainability Score. This meant that whenever a user previewed their or someone else's profile page, the sustainability score corresponding to the profile would update.
    • Potential Bug: I took this approach because I was unable to create an account through the sign-up portal and was forced to use the Django admin panel. Unsure if this is an issue for anyone else, but I do believe that it has to do with how I set up the program.
    • Workaround: I created accounts through the Django admin panel, and then made an account through the Docker shell. I was able to successfully log in to the accounts created through Docker.

Checklist:

  • I have checked that my changes do not introduce any breaking changes.
  • I have updated the documentation accordingly (if necessary).
  • I have commented my code, particularly in hard-to-understand areas.

Screenshots

changes

Additional Notes

Check if sign up works on other machines

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.

1 participant