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

bar graph link #2398

Merged
merged 24 commits into from
Sep 17, 2024
Merged

bar graph link #2398

merged 24 commits into from
Sep 17, 2024

Conversation

bgoldowsky
Copy link
Contributor

@bgoldowsky bgoldowsky commented Sep 9, 2024

This includes all of PT-188127118 and PT-188212456, and parts of PT-185294648 .

Toolbar added; single button to link/unlink datasets.

By default the first attribute from dataset is set as the primary category for the bar graph; this can be changed with the x-axis pulldown menu.

By default there is no secondary ("Sort by") attribute, but one can be chosen from the legend.

Bar graph should be displayed properly with no data, single attribute, or two attributes.

Changes to dataset should be immediately reflected, including naming, attributes added/deleted/changed, values changed, cases added/removed.

A later PR will round out the functionality for the legend, including automatically adjusting tile height and improved design fidelity.

Copy link

codecov bot commented Sep 9, 2024

Codecov Report

Attention: Patch coverage is 97.68340% with 6 lines in your changes missing coverage. Please review.

Project coverage is 86.29%. Comparing base (812c3c4) to head (de397eb).
Report is 25 commits behind head on master.

Files with missing lines Patch % Lines
src/plugins/bar-graph/bar-graph-content.ts 97.67% 2 Missing ⚠️
src/plugins/bar-graph/bar-graph-tile.tsx 92.30% 2 Missing ⚠️
src/plugins/bar-graph/editable-axis-label.tsx 93.33% 1 Missing ⚠️
src/plugins/bar-graph/legend-area.tsx 96.77% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2398      +/-   ##
==========================================
+ Coverage   86.16%   86.29%   +0.13%     
==========================================
  Files         736      739       +3     
  Lines       37814    37955     +141     
  Branches     9626     9680      +54     
==========================================
+ Hits        32584    32755     +171     
+ Misses       4931     4903      -28     
+ Partials      299      297       -2     
Flag Coverage Δ
cypress-regression 78.03% <97.50%> (+0.25%) ⬆️
cypress-smoke 27.94% <4.18%> (-0.14%) ⬇️
jest 48.72% <74.78%> (-0.03%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link

cypress bot commented Sep 9, 2024

collaborative-learning    Run #13775

Run Properties:  status check passed Passed #13775  •  git commit de397eb40f: Merge remote-tracking branch 'origin/master' into 188127118-bar-graph-link
Project collaborative-learning
Branch Review 188127118-bar-graph-link
Run status status check passed Passed #13775
Run duration 13m 40s
Commit git commit de397eb40f: Merge remote-tracking branch 'origin/master' into 188127118-bar-graph-link
Committer Boris Goldowsky
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 0
Tests that did not run due to a developer annotating a test with .skip  Pending 3
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 110
View all changes introduced in this branch ↗︎

Copy link
Member

@scytacki scytacki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm going to approve this even though I found a couple of problems. I figure you'd likely want to fix those in a later PRs.

When I duplicated a bar graph tile the document got corrupted:
https://collaborative-learning.concord.org/branch/bar-graph-link/?appMode=demo&demoName=ScottRemote&fakeClass=1&fakeUser=student:1&problem=0.1&unit=./demo/units/qa/content.json

I also noted where it seems the dataSet should be a view instead of a volatile. I know there is a separate story about fixing the syncing, so that doesn't need to be addressed here.
And perhaps the document crash is also something you want to punt to another PR.

if (self.dataSet !== dataSet) {
self.setPrimaryAttribute(undefined);
self.setSecondaryAttribute(undefined);
self.dataSet = dataSet;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is where it'd be better to have a get dataSet view that is using MST to cache the dataSet instead of doing it manually here in the updateAfterSharedModelChanges action. Many other tile content models use a similar pattern. If you search for get sharedModel() I think you'll find them all.

@bgoldowsky
Copy link
Contributor Author

I see. The crash is due to a simple omission of a null check. But it reveals that I neglected to provide an updateContentWithNewSharedModelIds method. It makes sense to take care of this in the same PR that has the refactoring to get sharedModel.

@bgoldowsky
Copy link
Contributor Author

Just noting that duplicating the tile will also make a copy of the dataset - the new tile will not remain connected to whatever other tile the original bar graph was linked to. This seems to be how all CLUE tile duplicates work.

Add ID update function to fix tile copy issue.
Prevent changes in read-only mode.
When changing primary attribute, reset secondary as part of the same action to support undo.
Make EditableAxisLabel handle things more locally to fix sync bugs.
Test read-only views
Test undo and redo of each operation.
Add classes in DocEditorApp to support testing.
@bgoldowsky bgoldowsky merged commit 7a65c8c into master Sep 17, 2024
17 checks passed
@bgoldowsky bgoldowsky deleted the 188127118-bar-graph-link branch September 17, 2024 18:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants