How we store meal times, order and grouping
We stored the time eaten, the order of foods and the meal each belonged to separately, then matched them up again. We decide which is the source and change how they are stored.
You couldn't put a divider between two foods eaten at the same time. So even for foods actually eaten at the same moment, we gave each a one-second gap. We were changing the time eaten just to get the order right on screen. Editing a meal's time changed the time of every food in it.
We could write more rules to keep the three values in line. But first we should ask: does the time really have to decide which meal a food is in? What people see is the order in which foods and dividers are placed. If we treat that line as the source, a food belongs to the meal of the divider right above it, and we can put a divider between foods without touching any time.
If we can remove it, should we remove all of it?
Our first plan was to keep only the order and drop each food's time. It looked much simpler, but review turned up a counterexample: a day could look different in the released app and in the new one. A cleaner structure doesn't give us the right to read the records of people using the app today differently. So we switched to a single line, and kept the reading rules the same as the released app's.
We didn't add or remove any stored fields. We had hoped to cut the nutrition code to about 4,000 lines, but it only went from 4,897 lines to 4,887. A simpler structure doesn't necessarily mean shorter code.
Photos still have a limit of their own. If two devices each upload a photo to the same meal, only the one saved later may survive.
Written from that day’s point of view, using the documents and change history of the time. Published 2026.12.01.
