Open maxpatiiuk opened 1 year ago
Probably using database views would be the most principled way of doing this. Then Specify queries and other APIs could access these fields in a consistent way as if they were normal fields. There would need to be a way to add the views to the database. Presumably this could be done using custom Django migrations. Also there would need to be some way to cause the backend to use the views when retrieving data from such tables but continue to issue updates and inserts to the underlying bare tables. MySQL does support updatable and insertable views, but I wouldn't bet on them being fit for use.
From @grantfitzsimmons:
This includes
isOnLoan
andactualCountAmt
The "Is on Loan" indicator that you can see in the preparation section of a form is not currently a field option in the query builder:
Requested By: Dan Baker at CSIRO (Asana)
The Sp6 query builder supports querying on calculated fields. The Sp7 query builder appears to not support them.
From @grantfitzsimmons:
Example Calculated Fields:
Preparation
actualCountAmt
isOnLoan
Loan https://github.com/specify/specify7/issues/1193
totalPreps
totalItems
unresolvedPreps
unresolvedItems
resolvedPreps
resolvedItems
Accession https://github.com/specify/specify7/issues/4802
totalCountAmt
actualTotalCountAmt
actualCountAmt
collectionObjectCount
preparationCount
Exchange Out, Disposal, Gift, and Deaccession https://github.com/specify/specify7/issues/2521
totalPreps
totalItems
Reported by CSIRO
From Asana: https://app.asana.com/0/1201972579963460/1203248913489633
See also #1193