Skip to content

Commit

Permalink
solve bug 0000358
Browse files Browse the repository at this point in the history
  • Loading branch information
domjos1994 committed Oct 29, 2019
1 parent ced0183 commit ccbf380
Showing 1 changed file with 36 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@
import de.domjos.unitrackerlibrary.interfaces.IBugService;
import de.domjos.unitrackerlibrary.interfaces.IFunctionImplemented;
import de.domjos.unitrackerlibrary.model.issues.Issue;
import de.domjos.unitrackerlibrary.model.projects.Version;
import de.domjos.unitrackerlibrary.tasks.IssueTask;
import de.domjos.unitrackerlibrary.tasks.VersionTask;
import de.domjos.unitrackerlibrary.utils.MessageHelper;
import de.domjos.unitrackermobile.R;
import de.domjos.unitrackermobile.adapter.PagerAdapter;
Expand Down Expand Up @@ -100,6 +102,40 @@ protected void initControls() {
if (this.pagerAdapter.validate()) {
this.issue = (Issue) this.pagerAdapter.getObject();
this.issue.setId(this.id.equals("") ? null : this.id);
VersionTask versionTask = new VersionTask(IssueActivity.this, this.bugService, pid, false, this.settings.showNotifications(), "versions", R.drawable.ic_bug_report_black_24dp);
List<Version> versions = versionTask.execute(0).get();
boolean exists1 = false, exists2 = false, exists3 = false;
for(Version version : versions) {
if(version.getTitle().trim().equals(issue.getVersion())) {
exists1 = true;
}
if(version.getTitle().trim().equals(issue.getFixedInVersion())) {
exists2 = true;
}
if(version.getTitle().trim().equals(issue.getTargetVersion())) {
exists3 = true;
}
}

if(!exists1) {
versionTask = new VersionTask(IssueActivity.this, this.bugService, pid, false, this.settings.showNotifications(), "versions", R.drawable.ic_bug_report_black_24dp);
Version current = new Version();
current.setTitle(issue.getVersion());
versionTask.execute(current).get();
}
if(!exists2) {
versionTask = new VersionTask(IssueActivity.this, this.bugService, pid, false, this.settings.showNotifications(), "versions", R.drawable.ic_bug_report_black_24dp);
Version current = new Version();
current.setTitle(issue.getFixedInVersion());
versionTask.execute(current).get();
}
if(!exists3) {
versionTask = new VersionTask(IssueActivity.this, this.bugService, pid, false, this.settings.showNotifications(), "versions", R.drawable.ic_bug_report_black_24dp);
Version current = new Version();
current.setTitle(issue.getTargetVersion());
versionTask.execute(current).get();
}

new IssueTask(IssueActivity.this, this.bugService, pid, false, false, this.settings.showNotifications(), R.drawable.ic_bug_report_black_24dp).execute(this.issue).get();
this.manageControls(false, true, false);
this.setResult(RESULT_OK);
Expand Down

0 comments on commit ccbf380

Please sign in to comment.