Closed slmyers closed 8 years ago
perhaps just select first X from each table? And use caching?
If you need to build a two-stage system, where a change has to go through an approval, I'd add a flag column to each important table that would indicate that values in the given row are not final and have to be approved. The table would store all historical changes to the data and with the help of this flag the system would know which variant is the latest approved version and which variant is pending and waiting for approval.
I implemented this in the data model by adding an approved column. I can't remember if SQL has a bool
datatype, so I just put it as int
.
There might be a problem with updating a person's information now... because until the update is approved the person will not be searchable. Contact client to see if this is acceptable?
expansion:
Person X is in db and approved,
X.name is edited/changed,
Person X is in db and not approved.
problem?
reference
The current notification system will be something along the lines of
for each res in results determine non-null foreign key
for each non-null foreign key in results select row
render json for each row in 3
this seems inefficient. Perhaps we should investigate caching in rails or a more efficient data mode.