401ChemistryGenealogy / ChemistryGenealogy

401 project for the client: Dr. Todd Lowary
0 stars 1 forks source link

pending admin action data model #22

Closed slmyers closed 8 years ago

slmyers commented 8 years ago

reference

The current notification system will be something along the lines of

  1. SELECT * FROM PENDING LIMIT 25 // limit implies some type of pagination
  2. for each res in results determine non-null foreign key
  3. for each non-null foreign key in results select row
  4. render json for each row in 3

this seems inefficient. Perhaps we should investigate caching in rails or a more efficient data mode.

slmyers commented 8 years ago

perhaps just select first X from each table? And use caching?

slmyers commented 8 years ago

stack overflow question

slmyers commented 8 years ago

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.

-- stackoverflow

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.

slmyers commented 8 years ago

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?