Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding paleo context as subview in collecting event table causes issues #725

Closed
yvonneekanim opened this issue Aug 26, 2020 · 16 comments
Closed
Assignees
Labels
1 - Request Improvements or extensions to existing behavior 2 - Forms Issues that are related to the form system

Comments

@yvonneekanim
Copy link

yvonneekanim commented Aug 26, 2020

I've attached screenshots of what the same paleo context subform looks like as a subview in CE table vs CO table. It looks the same in both tables in Specify 6
Paleo context subform in collecting event table:
CE table
Paleo context subform in collection object table:
CO table

@yvonneekanim yvonneekanim added the 1 - Request Improvements or extensions to existing behavior label Aug 26, 2020
@yvonneekanim
Copy link
Author

yvonneekanim commented Jun 2, 2021

Paleo context only works as a subview in CO if it is embedded

@maxpatiiuk maxpatiiuk added the todo:verify Needs Verification label Jul 23, 2022
@grantfitzsimmons
Copy link
Member

grantfitzsimmons commented Jul 25, 2022

image

I have not been able to to add a paleoContext subview on the CE form. It appears but I cannot add items.

                <row>
                    <cell type="label" labelfor="pcsh"/>
                    <cell type="field" uitype="querycbx" id="pcsh" name="paleoContext" initialize="name=PaleoContext" colspan="10"/>
                </row>
                <row>
                    <cell type="subview" viewname="SubPaleoContext" id="pcem" name="paleoContext" defaulttype="table" colspan="9"/>
                </row>

db: Invertpaleo
https://testability.test.specifysystems.org/specify/view/collectingevent/new/

@maxpatiiuk
Copy link
Member

maxpatiiuk commented Sep 13, 2022

It looks like SubViews for independent fields are rendered as read-only.
I copied that logic from the previous implementation of SubViews:

var mode = self.field.isDependent() && !this.readOnly ? 'edit' : 'view';

It's easy to remove that.
@benanhalt do you know why that was added initially?

Is it related to #114?

@maxpatiiuk maxpatiiuk removed the todo:verify Needs Verification label Sep 13, 2022
@benanhalt
Copy link
Contributor

Yes. That is the intended behavior. If the paleocontext is set to be embedded according to the schema, then self.field.isDependent() should be true. If it's not then that is the bug.

@maxpatiiuk
Copy link
Member

maxpatiiuk commented Sep 13, 2022

That is the intended behavior

Can you explain why?

Also, CollectingEvent -> paleoContext is not set as dependent at the moment.

@grantfitzsimmons
Copy link
Member

When creating a new accession record in Specify 6, the Repository Agreement subview under the Accession table is working correctly.

Screen Shot 2022-09-15 at 9 21 45 AM

When creating a record in Specify 7, there is no way to add a Repository Agreement to an Accession record. The + icon is disabled.

image

This is in the same database with the same forms.

The behavior begins to complicate after saving the Accession record:

image

Now a Repository Agreement is randomly assigned. I created a single repository agreement in this database and it immediately selected it. There is no way to remove this relationship or modify it.

When viewing the same record in Specify 6, it shows there is no Repository Agreement assigned.

image

image

Database: pripaleo
User: kmiller

https://pripaleo-edge.test.specifysystems.org/specify/view/collectionobject/70641/

paleo.views.xml

Reported By: Matthew Cruz at The University of Michigan

@grantfitzsimmons
Copy link
Member

grantfitzsimmons commented Sep 15, 2022

@maxpatiiuk

It affects all subviews to non-dependent relationships. We need to figure out why that limitation was put in place. Once we do, removing it is easy.

@maxpatiiuk
Copy link
Member

Solutions:

  • Either mark paleo context relationship as dependent
  • Or, render the relationship as a query combo box rather than a SubView. @grantfitzsimmons does this solution work for you?

@maxpatiiuk maxpatiiuk removed this from the 7.8.0 milestone Sep 19, 2022
@grantfitzsimmons
Copy link
Member

What is the issue with marking paleo context as dependent?

@grantfitzsimmons
Copy link
Member

And how can I verify that this has been solved? Is it on testability?

@maxpatiiuk
Copy link
Member

This has not been fixed yet. If you want paleo context to be displayed as a SubView, ask Ben to mark it as a dependent

@grantfitzsimmons
Copy link
Member

@benanhalt Can you mark this relationship as dependent to solve this problem?

@benanhalt
Copy link
Contributor

It isn't always dependent. It can be set to embedded or not, and also it can be set to be embedded in different tables. So the dependent status depends on those settings. I can check to see if it is properly respecting the settings.

@benanhalt
Copy link
Contributor

benanhalt commented Sep 29, 2022

The logic is handled here:

public isDependent(): boolean {
// TODO: move this into SchemaExtras.ts
return this.model.name == 'CollectionObject' &&
this.name == 'collectingEvent'
? schema.embeddedCollectingEvent
: this.model.name.toLowerCase() == schema.paleoContextChildTable &&
this.name == 'paleoContext'
? schema.embeddedPaleoContext
: this.dependent;
}

It looks like it is implemented so you need to check if the database has paleo context set to be embedded in collecting event in this database.

@maxpatiiuk
Copy link
Member

Now a Repository Agreement is randomly assigned. I created a single repository agreement in this database and it immediately selected it. There is no way to remove this relationship or modify it.

This could be just a visual bug. @grantfitzsimmons Are you still able to replicate it

Current behavior:
If "embeddedPaleoContext" boolean is true for the current collection (can be changed on the collection form), then Paleo Context can be displayed as a SubView/form table. Otherwise, it can only be displayed as a query combo box or a subview button
@grantfitzsimmons does that sound good? In which case this issue can be closed

@grantfitzsimmons grantfitzsimmons added 2 - Forms Issues that are related to the form system and removed Unsorted labels Jul 2, 2023
@grantfitzsimmons
Copy link
Member

Same rule applies to Collecting Events.

If "IsEmbeddedCollectingEvent" boolean is true for the current collection (can be changed on the collection form), then Collecting Event can be displayed as a SubView/form table. Otherwise, it can only be displayed as a query combo box or a subview button

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1 - Request Improvements or extensions to existing behavior 2 - Forms Issues that are related to the form system
Projects
None yet
Development

No branches or pull requests

4 participants