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

Removed redundant parameters in ImageSequencer.js #967

Merged
merged 3 commits into from
Apr 5, 2019
Merged

Removed redundant parameters in ImageSequencer.js #967

merged 3 commits into from
Apr 5, 2019

Conversation

vajean
Copy link

@vajean vajean commented Mar 31, 2019

Fixes #959

Make sure these boxes are checked before your pull request (PR) is ready to be reviewed and merged. Thanks!

  • tests pass -- look for a green checkbox ✔️ a few minutes after opening your PR -- or run tests locally with npm test
  • code is in uniquely-named feature branch and has no merge conflicts
  • PR is descriptively titled
  • ask @publiclab/is-reviewers for help, in a comment below

We're happy to help you get this ready -- don't be afraid to ask for help, and don't be discouraged if your tests fail at first!

If tests do fail, click on the red X to learn why by reading the logs.

Please be sure you've reviewed our contribution guidelines at https://publiclab.org/contributing-to-public-lab-software

Thanks!

I think I need more details to the last phrase in the instructions, telling me to remove the export of loadImages, I tried deleting that line and cannot pass the test.
@vajean
Copy link
Author

vajean commented Mar 31, 2019

@publiclab/is-reviewers
Please review my PR:
Done removing redundant parameters.
I could not manage to remove "loadimages export at the end of the file" - when I do, it will not pass the tests. I must have misunderstood something.

@harshkhandeparkar
Copy link
Member

@publiclab/is-reviewers

@harshkhandeparkar
Copy link
Member

I could not manage to remove "loadimages export at the end of the file" - when I do, it will not pass the tests. I must have misunderstood something.

Does the issue mention something like that?

@vajean
Copy link
Author

vajean commented Apr 1, 2019

The issue says:
... Also since now sequencer image can hold only one image at a time, loadimages export at the end of the file can be removed.

@harshkhandeparkar
Copy link
Member

Ok let it be. Doesn't matter.

@harshkhandeparkar
Copy link
Member

@Divy123 does ImageSequencer no longer hold multiple imgs? Also please review this.

@Divy123
Copy link
Member

Divy123 commented Apr 1, 2019

@vajean you can leave the loadImages() part.
I will have a look there and make it a new isssue.
@harshkhandeparkar yes now we support only one image per sequencer.

@Divy123
Copy link
Member

Divy123 commented Apr 1, 2019

@vajean I also request you to test your branch's code in browser as sometimes only the tests are not sufficient .
If everything goes well, the PR will be ready to merge.
Thanks a lot for your precious contributions.

@harshkhandeparkar
Copy link
Member

yes now we support only one image per sequencer.

What is the use of sequencer.images ?

@harshkhandeparkar
Copy link
Member

I mean loadImages()

The func name is the same

@harshkhandeparkar
Copy link
Member

Does it not support multiple images or different steps for different imgs?

@harshkhandeparkar
Copy link
Member

I mean that sequencer.loadImage and sequencer.loadImages both return the same function called loadImages. The function loadImages supports multiple arguements.

@harshkhandeparkar
Copy link
Member

This is from src/ImageSequencer.js

function loadImages() {
    var args = [];
    var prevSteps = this.getSteps().slice(1).map(step=>step.options.name)
    var sequencer = this;
    sequencer.image = arguments[0];
    for (var arg in arguments) args.push(copy(arguments[arg]));
    var json_q = formatInput.call(this, args, "l");
    if(this.getSteps().length!=0){
      this.options.sequencerCounter = 0;
      inputlog = [];
      this.steps = [];
    }
    inputlog.push({ method: "loadImages", json_q: copy(json_q) });
    var ret = {
      name: "ImageSequencer Wrapper",
      sequencer: this,
      addSteps: this.addSteps,
      removeSteps: this.removeSteps,
      insertSteps: this.insertSteps,
      run: this.run,
      UI: this.UI,
      setUI: this.setUI
    };

@jywarren
Copy link
Member

jywarren commented Apr 1, 2019 via email

@Divy123
Copy link
Member

Divy123 commented Apr 2, 2019

@jywarren the loadImages() and loadImage() are an abstraction of the same function loadImages(). But since we use only one image, I think we can remove loadImages() from the export but since @vajean is encountering some error removing which can be due to its usage in some UI code, I will send a PR after figuring it out.

@vajean
Copy link
Author

vajean commented Apr 2, 2019

@vajean I also request you to test your branch's code in browser as sometimes only the tests are not sufficient .
If everything goes well, the PR will be ready to merge.
Thanks a lot for your precious contributions.

Hi, I have installed and tested it in a browser on my computer, everything works as the demo on your repo.

@Divy123
Copy link
Member

Divy123 commented Apr 5, 2019

I think this is ready to be merged.
@publiclab/is-reviewers @jywarren please merge this.

@@ -102,7 +102,7 @@ ImageSequencer = function ImageSequencer(options) {
return this;
}

function insertSteps(image, index, name, o) {
function insertSteps() {
Copy link
Member

Choose a reason for hiding this comment

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

Hmm, was this at some point to allow inserting a step at a different index? And same for removeSteps() above? @Divy123

Thank you!

Copy link
Member

Choose a reason for hiding this comment

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

I think we are managing that through arguments array.

@jywarren jywarren merged commit 7cf96df into publiclab:main Apr 5, 2019
@welcome
Copy link

welcome bot commented Apr 5, 2019

Congrats on merging your first pull request! 🙌🎉⚡️
Your code will be published to https://beta.sequencer.publiclab.org in a day or two.
In the meantime, can you tell us your Twitter handle so we can thank you properly?
Now that you've completed this, you can help someone else take their first step!
See: Public Lab's coding community!

@jywarren
Copy link
Member

jywarren commented Apr 5, 2019

Thank you!!! This is great.

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.

4 participants