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

[Density - Mystery Screen] MaterialProperty has "optionalTandem" valid values #307

Closed
arouinfar opened this issue Aug 2, 2024 · 7 comments
Assignees

Comments

@arouinfar
Copy link

Related to #270 and phetsims/buoyancy#51

I reviewed the valid values of materialProperty for all blocks/objects in the Density/Buoyancy suite, and discovered that Density's Mystery screen has some extraneous options. There are three "optionalTandem" options under valid values, which should be removed.
image

Assigning to @AgustinVallejo and @samreid.

@samreid
Copy link
Member

samreid commented Aug 2, 2024

I'll take a look. Solo-assigning for now

@samreid
Copy link
Member

samreid commented Aug 2, 2024

From this patch, I can see the optionalTandems are copper, steel and platinum:

Subject: [PATCH] Add documentation and TODOs, see https://github.com/phetsims/density-buoyancy-common/issues/123
---
Index: js/common/model/Mass.ts
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/js/common/model/Mass.ts b/js/common/model/Mass.ts
--- a/js/common/model/Mass.ts	(revision 2a6d113f09c3667ce4c9ef102c8fdd5cf4cd0e81)
+++ b/js/common/model/Mass.ts	(date 1722632737249)
@@ -247,10 +247,16 @@
     }, options.customMaterialOptions ) );
 
     const initialMaterial = options.material === 'CUSTOM' ? customSolidMaterial : options.material;
+    const myMaterials = options.availableMassMaterials.map( x => x === 'CUSTOM' ? customSolidMaterial : x );
     this.materialProperty = new MaterialProperty( initialMaterial, customSolidMaterial,
-      options.availableMassMaterials.map( x => x === 'CUSTOM' ? customSolidMaterial : x ),
+      myMaterials,
       options.materialPropertyOptions as MaterialPropertyOptions );
 
+    myMaterials.forEach( material => {
+      console.log( material.nameProperty.value );
+      console.log( material.phetioID );
+    } );
+
     // There are complicated order dependencies in how DynamicProperties unlink to old values and link to new ones. See https://github.com/phetsims/buoyancy/issues/67
     // Note: Just NOTIFY didn't work, neither did internalVisibleProperty.addPhetioStateDependencies()
     if ( this.materialProperty.isPhetioInstrumented() ) {

I can also see that those 3 materials do exist in density 1.1:

image

Therefore, it seems we should instrument those and keep them, unless we decided to purposefully remove them.

@samreid
Copy link
Member

samreid commented Aug 2, 2024

I did not see mention of purposefully removing copper, platinum, steel in #282 where they were removed. So I restored them in the commit.

Next I observed the same problem for gravity (some optionalTandems in density), and I will work on that next (probably removing them in that case).

@arouinfar
Copy link
Author

I did not see mention of purposefully removing copper, platinum, steel in #282 where they were removed. So I restored them in the commit.

@samreid I didn't list all of the materials, but this falls under the last point, "Materials should only appear in the trees of relevant sims." Copper, platinum, and steel are not user-selectable materials in Density.

Next I observed the same problem for gravity (some optionalTandems in density), and I will work on that next (probably removing them in that case).

Good catch! Sounds good.

@arouinfar
Copy link
Author

I somehow missed @samreid's first comment in #307 (comment). I don't know why platinum, copper, and steel were valid values in Density 1.1. That said, I don't think it's worth the effort to remove them in 1.2, as their presence is benign.

@samreid
Copy link
Member

samreid commented Aug 2, 2024

Sounds good, thanks. Next, I removed the uninstrumented gravity values on density and buoyancy-basics via a filter. It was easy to find them by searching for optionalTandem in the API files.

I think this issue is ready for review.

@arouinfar
Copy link
Author

Thanks @samreid looks good on main, closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants