Giter Club home page Giter Club logo

jtroussard / tracker-app Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 0.0 37.81 MB

Welcome to the super simple fitness tracker! A simple journaling tool for weight loss and other fitness goals. Currently in development so there might still be some bugs. Full stack project, deployed in gcp.

Home Page: https://trackerapp.devlife4.me/

License: GNU General Public License v3.0

Makefile 0.66% Python 50.43% HTML 44.28% CSS 2.58% Mako 0.49% JavaScript 1.55%
flask fullstack python webapplications

tracker-app's Introduction

Fitness Tracker

Welcome to the super simple fitness tracker! This is intended more to be a simple journaling tool for weight loss or other fitness/physical goals. It is still currently in development so there might still be some small bugs. Another motivation for creating this app is as an exercise in full stack web development, however! contributions, and feedback greatly appreciated.

Installation

  1. Clone this repository:
    git clone https://github.com/jtroussard/tracker-app.git

  2. Navigate into the project directory:
    cd tracker-app

  3. It is recommended to build inside a vitrual environment, this step is optional:
    python3 -m venv venv && source venv/bin/activate

  4. Install the required packages:
    pip install -r requirements.txt

Usage

To run the application, execute the following command from the root directory of the project:
python run.py or python3 run.py depeneding on your aliases (requires Python 3.X)

The application will now be running at http://localhost:8888/.

Testing

To run unit tests, execute the following command from the root directory of the project: make test

Linting

To run linting using pylint, execute the following command from the root directory of the project: pylint app/

Screen Shots

Home page screen shot Account page screen shot Entries page screen shot Registration page screen shot

Attributions

Photos

https://www.publicdomainpictures.net/en/browse-author.php?a=87

tracker-app's People

Contributors

dependabot[bot] avatar jpc1505 avatar jtroussard avatar

Stargazers

 avatar

Watchers

 avatar  avatar

tracker-app's Issues

create flask skeleton

Developer Tasks

This task is for setting up flask skeleton and developer environment only.

  • Create skeleton framework
  • Create virtual environment
  • Install Flask
  • Create requirements.txt
  • Set testing pattern with pytest
  • Create test and coverage script

AC

  • Stand up hello world server

FEATURE: create release and deploy script

Create a script that does the following:

  • Check out the latest release
  • Copy the project to the specified directory
  • Change into the service directory
  • Install dependencies
  • Check if Nginx config file has changed
  • Reload Nginx configuration if changed
  • Restart Nginx server if configuration was reloaded
  • Reread the Supervisor configuration file
  • Restart Supervisor to reload the app

TD: Entry edit workflow stuck

Upon saving changes to an entry should either

  • return to entry index
  • return to entry single but have cancel button to return to entry index

Waist measurement field validation triggers and prevents form submition

Summary

  1. All form fields besides waist measurement are populated
  2. user tries to submit form
  3. field validation for non floating number is present for waist measurement field
  4. should allow submission without data in optional field

Dependencies

None

AC

TBD

Notes

TBD

Development Tasks

TBD

UI: create entry tile

Developer Tasks

  • Use generic tile to create and entry tile.
  • Tile should contain date, weight

FT: add a dark mode switch

Summary

add a dark mode switch

Dependencies

  • dark mode styles
  • dark mode implementation

AC

TBD

Notes

TBD

Development Tasks

TBD

FE: add new entry

Developer Tasks

  • Make entry form add a task
  • Flash on success/unsuccessful

FEATURE: migrate database from sqlite to postgresql

Developer Tasks

  • Install the psycopg2 package
  • Install the Flask-Migrate package
  • Create a new PostgreSQL database and configure its access. (pgAdmin)
  • Update app configuration (weight_tracker/config/development.py)
  • Generate a migration script (Flask-Migrate)
  • Write tests

Flask-Migrate Hints

flask db migrate // creates a new migration script in the migrations dir
flask db upgrade // creates tables in the new PostgreSQL db & updates the schema to match the new migration

FE: log in user

Developer Tasks

  • make log in form work
  • display flash message that log in was successful
  • display flash message that log in was unsuccessful
  • redirect to the tracker page

FT: add unit of measurement config

Summary

Implement a per account setting for system of measurement

Dependencies

  • Database/backend design
  • Translation service

AC

  • As a user, When I go to my account settings page, Then there is a setting for unit of measurement
  • As a user, When I set my unit of measurement setting, all forms display a default measurement that corresponds with the field's unit.

Notes

Design not set yet, but leaning towards setting all the data in the database as metric, then adding a backend translation layer that would make any calculations before passing them to the front end. Look into middleware or custom filters.

Development Tasks

  • Add a field to the user model to store the system of measurement
    • "imperial" or "metric".
  • On login, retrieve user's system of measurement preference from the database and store it in the session object
    • suggestion: session['system_of_measurement']
  • Use the session variable to render the correct unit on the forms. (another ticket to create the generic measurements component)
  • When the form is submitted, retrieve the system_of_measurement value from the session object and use it to convert the weight to the appropriate units.
class User:
    def __init__(self, id, system_of_measurement):
        self.id = id
        # ... and so on
        self.system_of_measurement = system_of_measurement


class WeightForm(FlaskForm):
    weight = FloatField('Weight', validators=[InputRequired())
    system = SelectField('System of Measurement', choices=[('imperial', 'Imperial'), ('metric', 'Metric')])
    submit = SubmitField('Submit')

@app.route('/tracker', methods=['GET', 'POST'])
def tracker():
    # check for user code

    # init form stuff here
    form = WeightForm()
    form.system.default = user.system_of_measurement
    # for the default values (dbl check this) -> form.process()

    if form.validate_on_submit():
        weight = form.weight.data
        # on submit, send to some other back end service to make the translations before committing to the database

UI: create layout with navigation bar

Developer Tasks

  • Add layout template
  • Add navigation bar
    • Home -> (should redirect to tracker page)
    • Login/Logout
    • Registration
    • Tracker
  • Add bootstrap
  • Add interpolation for login name in the navbar

FE: create initial models

Developer Tasks

  • User
    • email
    • password
    • first name
    • last name
  • Tracker Entry
    • date
    • mood
    • time of day
    • weight
    • measurement
    • keto

Refactor into models.py file

UI: add entry form

Add a new form for weight entry. Include the following columns

  • Date
  • Time of day (Morning/Night)
  • Mood (good, middle, sad)
  • weight
  • measurements (waist)
  • keto (some number or color)

FT: account page epic - finish side bar (AC WIP)

finish account side bar

ac ?

Have the chart map and correspond to whatever is in the data section, data section should be flipped via the side bar. side bar will have main control and then page controls section

FE: register new user

Developer Tasks

  • Register new user
  • Display flash message on successful registration
  • Display flash message on unsuccessful registration
  • Redirect to the tracker page on success

BUG: tracker form validation is all screwed up

Summary

Alpha input for weight field triggers 'data required' error message. Should trigger 'input not valid for float field' or something about the data type.

Dependencies

None

AC

TBD

Notes

TBD

Development Tasks

TBD

BUG: broke registration form

correct validations for user.location and work out CSRF token error

There was a problem registering your account. {'location': ['Field must be between 1 and 50 characters long.'], 'csrf_token': ['The CSRF token is missing.']}

entry form errors don't clear when faulty input is cleared from a non-required field (see waist measurement)

Summary

  1. one of the non-required fields has input that triggers an error message
  2. user tries to submit form
  3. the error message is appended to the form.someField.error property
  4. message is rendered to the loading page
  5. the value is removed from the field
  6. user tries to submit the form
  7. error remains rendered to the loading page

as a non-required field it seems the validation should succeed, but it doesn't, and the error is not removed

Dependencies

None

AC

TBD

Notes

TBD

Development Tasks

TBD

BE: add database

Developer Tasks

  • Add database
    • MongoDB? Postgresql?
  • Migrate models

UI: create log in page

Developer Tasks

  • Create route log in
  • Create route log out
  • Create route register
  • Create page skeleton for all three

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.