Skip to content
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

Goal Setting Feature #233

Closed
5 tasks
uoa-lchu090 opened this issue Mar 18, 2022 · 1 comment · Fixed by #349
Closed
5 tasks

Goal Setting Feature #233

uoa-lchu090 opened this issue Mar 18, 2022 · 1 comment · Fixed by #349
Assignees
Labels

Comments

@uoa-lchu090
Copy link
Contributor

Description

This feature allows for a user to configure a goal as to how many people they have encountered each allotted time. User can configure the feature to be every day, every week, or every month, can set the number they want their goal to be, and can toggle whether or not it is recurring. A pop-up is displayed at the end of the allotted time to inform if the goal was met or not, and how many people they have encountered during the time frame.

Acceptance Criteria

  • create a goal counter component to be used in the homepage
  • create a pop-up component that will show if the goal was met at the end of the time
  • add component to homepage
  • modify settings page to allow for configuration of the goal setting
  • add backend logic to allow for counting the people met, as well as for configuring the feature

Implementation details

potential new endpoints depending on how pop-up is implemented, home page needs to be modified,new API calls need to be written for the new feature.

Testing notes

New tests needed for the feature.

@uoa-lchu090 uoa-lchu090 added feature new feature to be added to codebase backend frontend future labels Mar 18, 2022
@nzbasic nzbasic added the team-1 label Mar 25, 2022
@BruceZeng1 BruceZeng1 self-assigned this Mar 25, 2022
@nzbasic
Copy link
Collaborator

nzbasic commented Mar 25, 2022

Design Proposal

Goal Data Model

  • Date started: Date
  • Date ending: Date
  • Duration: string
  • Recurring: boolean

Frontend Requirements

  • Goal added to home page
    • Make a new GoalSummary component
    • Shows a circular progress meter for the current goal progress
    • If the goal is not done, it should say for example: "2 to go!"
    • If the goal is done, there should be text saying Goal Complete!
    • Shows the remaining time in human-readable form e.g. 1 hour or 3 days, etc
    • If there is no goal set, show some text telling them to add a goal
    • If there is a goal, there should be a button for goal settings
    • Hovering over the goal should show the goal settings
  • Goal add/settings modal
    • Will use same modal for adding and changing settings
    • Has 3 input fields:
      • Number of encounters needed: number input
      • Duration: dropdown with options: 1 day, 1 week, 1 month
      • Recurring: checkbox
    • If the modal is used for adding, the title should be "Add a new goal"
    • If the modal is used for editing, the title should be "Goal settings" and there should be an extra button to remove the goal

Backend Requirements

  • Add the new goal data model
  • Add goal to the person schema
  • Route GET /goal
    • If there is a goal, return the goal object and the progress
    • If there is no goal, return no content
    • Before it sends a goal, it should check if the end date has surpassed
      • If the date is surpassed and it is a recurring goal, update the current start/end dates accordingly
      • If the date is surpassed and it isn't a recurring goal, remove the goal and return no content
  • Route POST /goal
    • Creates a new goal
    • The body will contain: { encounters: number, duration: string, recurring: boolean }
    • Should use the duration string and the current date to compute the start/end date of the goal
  • Route PUT /goal
    • Updates the current goal
    • Same body contents as POST /goal
  • Route DELETE /goal
    • Deletes the current goal

UI
Goals added to front page
image

Goal in progress
image

Goal completed
image

Adding goal modal
image

Editing goal modal
image

@wjun856 wjun856 self-assigned this Mar 28, 2022
wjun856 added a commit to wjun856/Forgettable that referenced this issue Mar 30, 2022
wjun856 added a commit that referenced this issue Mar 30, 2022
* Added Goal Model

* Added goals to Person schema with temporary requirement of false

* Added goal controller and routes

* Removed goals from person model to add to users model

* Added goals to user model

* Added goal services to get/create/update/delete and user services to add/delete goals from user

* Implemented /GET /POST /PUT /DELETE goal apis

* Added api routes for testing

* Modified controller, routes, index for backend

* Fixed code which failed in tests, removed irrelevant test cases

* Changed behaviour of code according to requirements in issue #233 and refactored test

* Updated comments

* Fixed all test cases with new modified models

* Added progress data to goal model

* Added progress variable to goal examples in tests
wjun856 added a commit that referenced this issue Apr 3, 2022
* Added Goal Model

* Added goals to Person schema with temporary requirement of false

* Added goal controller and routes

* Removed goals from person model to add to users model

* Added goals to user model

* Added goal services to get/create/update/delete and user services to add/delete goals from user

* Implemented /GET /POST /PUT /DELETE goal apis

* Added api routes for testing

* Modified controller, routes, index for backend

* Fixed code which failed in tests, removed irrelevant test cases

* Changed behaviour of code according to requirements in issue #233 and refactored test

* Updated comments

* Fixed all test cases with new modified models

* Added progress data to goal model

* Added progress variable to goal examples in tests

* Removed progress variable from goal model, implemented get progress in /GET goals

* Updated return progress behaviour

* Modified the conditions when comparing dates and updated goal service

* Modified code according to pull request feedback
BruceZeng1 added a commit that referenced this issue Apr 3, 2022
* add circle progress

* create front end for displaying goal

* change edit button and add error checking for form

* minor visual change

* add update and delete goal methods

* cleaned methods

* added connection backend

* Refactor Co-authored-by: James Coppard

* refactor goal label setting

Co-authored-by: James <[email protected]>
@BruceZeng1 BruceZeng1 linked a pull request Apr 3, 2022 that will close this issue
@wjun856 wjun856 closed this as completed Apr 5, 2022
abis555 pushed a commit to abis555/Forgettable that referenced this issue Apr 5, 2022
* Added Goal Model

* Added goals to Person schema with temporary requirement of false

* Added goal controller and routes

* Removed goals from person model to add to users model

* Added goals to user model

* Added goal services to get/create/update/delete and user services to add/delete goals from user

* Implemented /GET /POST /PUT /DELETE goal apis

* Added api routes for testing

* Modified controller, routes, index for backend

* Fixed code which failed in tests, removed irrelevant test cases

* Changed behaviour of code according to requirements in issue se701team3#233 and refactored test

* Updated comments

* Fixed all test cases with new modified models

* Added progress data to goal model

* Added progress variable to goal examples in tests

* Removed progress variable from goal model, implemented get progress in /GET goals

* Updated return progress behaviour

* Modified the conditions when comparing dates and updated goal service

* Modified code according to pull request feedback
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants