Coder Social home page Coder Social logo

mydiet's Introduction

Hi there, I'm Nyok ๐Ÿ‘‹

I am code monkey, but it is not as bad as it sounds.


I'm currently eat ๐Ÿ’, working on a lot of ๐Ÿ  projects, and ๐Ÿคซ, on a project that should change the world.
But it is not exactly. But I want it.

Projects:


Diet tracking site prototype


Listening Now:

mydiet's People

Contributors

nyok avatar

Watchers

 avatar

mydiet's Issues

Storing dishes in the database and linking them to meals and products

Now: Each meal item is recorded separately.

Example: Buckwheat with chicken breast

meal table

id product_id datetime portion
56 10 2022-12-06 19:21:40 110
57 16 2022-12-06 19:22:13 120

products table

id title proteins fats carbohydrates calories
10 Chicken breast boiled 21.00 2.50 0.00 110.00
16 Boiled buckwheat (1 buckwheat + 2 water) 4.00 1.14 21.40 117.00

But what to do with more complex dishes (soups, salads)

Example: Crab salad consisting of 3 ingredients.

  • eggs, grams
  • crab sticks, grams
  • corn, grams

List Products

id title proteins fats carbohydrates calories
14 Egg 12.70 11.50 0.70 157.10
27 Crab sticks 9.50 0.10 13.30 92.00
28 Sweet corn 2.87 0.60 9.90 57.80

Salad ingredients

products grams proteins fats carbohydrates calories
4 Egg 280 35.56 32.2 1.96 439.88
Crab sticks 250 23.75 0.25 33.25 230.00
Sweet corn 140 4.02 0.84 13.86 80.92
Sum 670 63.33 33.29 49.07 750.80

Result

products grams proteins fats carbohydrates calories
Crab salad 100 9.45 4.97 7.32 112.06

Transferring the nutritional value calculation to the database

Now
The query takes the nutritional value of each meal from the database and
maximum, total (today), balance (load) nutritional value โ€” contained in the code and converted using php (multiplied, summed, subtracted)

Need to do

  • Initial data for the calculation add to the table database
  • Store all daily data so it can be retrieved easily rather than recalculated each time the page is displayed
  • Add/update/delete this data immediately to the database, when adding a record of food consumption

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.