phetsims / projectile-data-lab

"Projectile Data Lab" is an educational simulation in HTML5, by PhET Interactive Simulations.
GNU General Public License v3.0
0 stars 0 forks source link

SampleNumber not resetting in CODAP wrapper #153

Closed matthew-blackman closed 7 months ago

matthew-blackman commented 7 months ago

In the CODAP wrapper, hitting the 'Clear all' button in the sim does not reset the sample index. Let's make sure that after clearing a field, the next projectile landed is sampleNumber 1.

samreid commented 7 months ago

As I mentioned in Slack, sampleIndex (which was renamed to projectileIndex in https://github.com/phetsims/projectile-data-lab/issues/119) was a workaround since CODAP did not allow adding a row with no columns.

samreid commented 7 months ago

We want a new column like "caseIndex" name: 'caseIndex', description: 'The row number of the projectile data', type: 'numeric'. Or perhaps 'rowNumber'?

samreid commented 7 months ago

On second thought, @matthew-blackman and @catherinecarter and I decided we will always show launcher 1-6 or custom. And will check with Bill about the case index.

matthew-blackman commented 7 months ago

It is important to note that the native 'index' column in CODAP cannot be utilized for formulas or plots. Having a duplicated column for something like caseIndex does add value to the integration, despite appearing like a redundant column. Let's add this in addition to the recommendation in https://github.com/phetsims/projectile-data-lab/issues/153#issuecomment-1941862753.

samreid commented 7 months ago

Is it OK if the caseIndex column gets out of sync with the "index" column? Because if someone clears the codap table, the sim+wrapper will not know, and will keep going higher.

samreid commented 7 months ago

I implemented the following:

The caseIndex is computed from the live table, so it will always be in sync even if the user deletes rows. @matthew-blackman can you please review and close if all is well?

samreid commented 7 months ago

@matthew-blackman will swap the column order, everything else seems good.

matthew-blackman commented 7 months ago

Nice work @samreid! Reviewed the commits and all looks good. Swapped the column order in above commit, closing.