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

Modified to Change SensorWrapper to not implement Layer and fixed tests #5018

Open
wants to merge 19 commits into
base: develop
Choose a base branch
from

Conversation

ayeshare
Copy link
Collaborator

@ayeshare ayeshare commented Nov 6, 2020

Fixes #5011

Copy link
Collaborator

@helenayele helenayele left a comment

Choose a reason for hiding this comment

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

On this fix, we can't copy and paste a sensor at top level,

Image from Gyazo

But we are able to copy and paste a layer with sensors like this:

Image from Gyazo

Can we avoid this as well?

helenayele
helenayele previously approved these changes Nov 12, 2020
Copy link
Collaborator

@helenayele helenayele left a comment

Choose a reason for hiding this comment

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

Currently we are not able to copy and paste a sensor or a layer with sensors at top level
Image from Gyazo
We are not able to paste at top level a layer with shapes and sensors as well.

so approving...

@@ -188,14 +188,15 @@ public IStatus execute(final IProgressMonitor monitor, final IAdaptable info) th

protected List<EditableWrapper> itemsFor(final HasEditables parent) {
final List<EditableWrapper> res;
Copy link
Member

Choose a reason for hiding this comment

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

@ayeshare - have we lost the functionality where this code has been commented out?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I have implemented equivalent code for speciaal handling of TacticalDataWrapper now. But I am not sure how I can test it.

@@ -878,8 +878,6 @@ public static int mergeSensors(final Editable targetE, final Layers theLayers, f
for (int i = 0; i < subjects.length; i++) {
final SensorWrapper sensor = (SensorWrapper) subjects[i];
if (sensor != target) {
Copy link
Member

Choose a reason for hiding this comment

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

@ayeshare - the next line has been deleted. Wasn't it doing something useful?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

No it wasnt doing anything useful. The methods append(target) was being called and it was not implemented for SensorWrapper. We removed implements Layer on TacticalWrapper, as none of the methods from layer was implemented on TacticalWrapper.

Copy link
Member

Choose a reason for hiding this comment

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

This version of append is still in the file.

image

This call was essential to add the sensor cuts from the other sensor into the target sensor.

_mySensors.setName(SENSORS_LAYER_NAME);

_myDynamicShapes = new SplittableLayer(true);
_myDynamicShapes.setName(DYNAMIC_SHAPES_LAYER_NAME);

_mySolutions = new BaseLayer(true);
_mySolutions = new RestrictedBaseLayer<>(true);
Copy link
Member

Choose a reason for hiding this comment

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

_mySolutions can be restricted to instances of TMAWrapper

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done

@@ -974,7 +975,6 @@ else if (point instanceof SensorWrapper) {
existing = oldS;

// and append the data points
Copy link
Member

Choose a reason for hiding this comment

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

Are you sure the next line can be deleted?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, append was not implemented for TacticalDataWrapper and implements Layer was removed.

Copy link
Member

Choose a reason for hiding this comment

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

Hmm. Here's the behaviour. When a new Sensor is being added, we check to see if there is already a sensor of that name. If there is a sensor of that name we add the points from the new sensor to the existing one.

This PR loses the last bit of functionality - we aren't adding the sensor contact wrappers from the new sensor to the old one. We're ignoring them.

@IanMayo
Copy link
Member

IanMayo commented Nov 18, 2020

@ayeshare - the failing unit tests highlight that the SensorWrapper logic has changed.

I've tried to reinstate the correct logic, but a couple of unit tests are still failing.

We've also got some test2 failures related to SWT Thread Access.

Could you investigate the above please?

@helenayele
Copy link
Collaborator

@ayeshare , tried to re-test this PR after your modification, and everything is okay except #5021.

helenayele
helenayele previously approved these changes Nov 19, 2020
Copy link
Collaborator

@helenayele helenayele left a comment

Choose a reason for hiding this comment

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

In this fix:

  • Not able to paste a sensor or a group of sensors at top level folder, we are able to paste sensor or a group of sensors in a track folder only.
    So approving..

@IanMayo
Copy link
Member

IanMayo commented Nov 19, 2020

Still some unit tests to fix, please @ayeshare

https://travis-ci.com/github/debrief/debrief/builds/202717868#L5965

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

Successfully merging this pull request may close these issues.

Disallow pasting a sensor object to top level Layers object
3 participants