The point of the website is to show different foods, lets say from the fridge, and let people rate them.

The system will use two IDs

  • Food_ID
  • User_ID(divided into Admin and Average user)

There would be 2 databases.

Food database:

  • Food_ID
  • Name
  • Bio(well, if you want to tell a story about where you got the egg, like from a farm or shop. or special features)
  • Ratings
  • Expiring date

User database:

  • User_ID
  • User_Type(Admin, Average user)
  • Name
  • Bio/Info(Bio and other user related info, like day of creation)
  • Rating history

Also tables:

  • Main raiting page
  • Personal rating page
  • Expiring table

Now that the parts have been laid down, how does it all come together:

As said before, the system will mainly use two ID-s. First of all Food_ID. This is used to recognize the food that is being rated. A table, which users can see, will send the request to the database and retrieve the information for the required food_ID. The Ratings used in that database, will use the information(ratings) given by the users and record em in the database. After a certain amount of time, the ratings will be updated by simply calculating the mean( the sum of ratings given / the sum of ratings = Answer).
The expiring date will be used as a trigger. If the item has past the expiring date for a day, it would be removed from the table.
Now this is where the Food_ID makes its biggest play. On to the User_ID

The User_ID also retrieves information from the database. Now, depending on the User_type, Admins and other users will see a slightly different tables. The average user will see the name of the food, expiring date, rating(of the food) and a field, where they can put their own rating. The ratings themselves, as said before, are related to the Food_ID. Now all users have their own rating page, where they can see and change their past ratings. It works like this: When a user has rated an item the Food_ID of that item will go into the user’s Rating history. Every time a user views the main table the Food_IDs in his rating history will not be displayed. On the personal rating page, there will be a table which shows only those foods which the user has already rated for(like the name implies).
With the Admin, it’s a little bit different. First of all the Main rating page has a extra field, where the Admin can add items. This will be a row, which has empty spaces in the places of data.
In the Personal rating page, there will be the same rating table, like the average user has.

The Admin will also have an Expired food table where the foods, which have passed the “one day over expiring date” line, will be displayed. From that table, the Admin can delete the items from that table and thus from the entire database. This helps the admin to keep on eye on the things they have, for example: Mom can see which foods have expired in the fridge.

So this is kind of it, I hope it makes sense 😉