See first :
What is left from a meal is still good for three days, as long as it gets to the fridge fast enough, in a closed container, and does not stay there too long. The rule is simple: two hours at most at room temperature, then the fridge. A big quantity, a pot of soup or bolognese, gets split into several containers to cool faster. And what you will not eat within three days goes to the freezer the same evening.
Two hours. That is the time a cooked dish can spend on the table or the counter before going to the fridge. Beyond that, you do not keep it.
Two minutes after the meal, while someone clears the table.
The dish stayed on the table all night: it gets thrown away, even if it smells fine, and even if you reheat it. You do not know any more how long the container has been in the fridge: that is what the date in marker is for, and when in doubt, throw it away. The container was closed boiling hot: it is not dangerous, it just warmed up the fridge and made condensation.
The grandma-style bolognese sauce, doubled: half for tonight, the other half in two containers in the freezer, before you even sit down to eat.