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

What is the purpose of this code part? #2

Open
AngelaIp opened this issue Jul 16, 2018 · 1 comment
Open

What is the purpose of this code part? #2

AngelaIp opened this issue Jul 16, 2018 · 1 comment
Assignees
Labels
Type: Enhancement New feature or improvement. Type: Question I want to know more about this project.

Comments

@AngelaIp
Copy link
Contributor

Hi,

the Method Convert ECR to ECR contains the following code part:

var clientList = "";
var affItems = this.getItemsByXPath("Relationships/Item[@type='ECR Affected Item']");
for (var i=0; i<affItems.getItemCount(); i++) {
 clientList += "'" + affItems.getItemByIndex(i).getID() + "',";
}
clientList+="''";
var ecrItem = this.newItem("ECR","get");
ecrItem.setID(this.getID());
ecrItem.setAttribute("select","id");
var ecrAffItems = this.newItem("ECR Affected Item","get");
ecrAffItems.setAttribute("select","id");
ecrAffItems.setProperty("id",clientList,"not in");
ecrItem.addRelationship(ecrAffItems);
ecrItem = ecrItem.apply();
ecrAffItems = ecrItem.getItemsByXPath("Relationships/Item[@type='ECR Affected Item']");
for (i=0; i<ecrAffItems.getItemCount(); i++) {
 top.aras.getItemRelationship(this.node, "ECR Affected Item", ecrAffItems.getItemByIndex(i).getID(), true);
}

What is the purpose of this code part? The whole block can be completly removed and the Method will still work the same way as before.

Particularities:

  1. What is the purpose of the clientList? Looks like it should handle the use case, when multible ECRs shall be converted in one ECN. But this doesn´t seem to be possible in the current version yet.
  2. affItems is redefined later in the code.
  3. ecrItem is never used in the later code. This explains, why I can remove this block without negative effects.

Is there more background information available?

Thanks and best regards!
Angela

@EliJDonahue
Copy link
Member

Hi Angela,

It's likely that this code is leftover from some earlier version of the project. If removing it doesn't cause any negative behavior for you, feel free to remove it. Let's leave this issue open so we have a reminder to clean it up in the next release of the project.

Eli

@EliJDonahue EliJDonahue self-assigned this Jul 17, 2018
@EliJDonahue EliJDonahue added the Type: Enhancement New feature or improvement. label Jul 17, 2018
@EliJDonahue EliJDonahue added hacktoberfest Type: Question I want to know more about this project. labels Oct 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Enhancement New feature or improvement. Type: Question I want to know more about this project.
Projects
None yet
Development

No branches or pull requests

2 participants