From: Alan Knowles Date: Mon, 24 Dec 2018 06:58:10 +0000 (+0800) Subject: RooTicket.vala X-Git-Url: http://git.roojs.org/?p=gitlive;a=commitdiff_plain;h=4af20209165327cd256e80f2c3627aae80fc85a3 RooTicket.vala --- diff --git a/RooTicket.vala b/RooTicket.vala index 3d854010..4f2a52d7 100644 --- a/RooTicket.vala +++ b/RooTicket.vala @@ -34,16 +34,6 @@ public class RooOption : Object } -public class RooProject : Object -{ - public string id; // not really important that they are numbers.. - public string code; - public string name; - public string type; - -} - - static RooTicket _RooTicket; @@ -67,14 +57,14 @@ public class RooTicket : Object if (_RooTicket == null) { _RooTicket = new RooTicket(); _RooTicket.tickets = new Gee.ArrayList(); - _RooTicket.projects = new Gee.ArrayList(); + _RooTicket.repos = new Gee.ArrayList(); _RooTicket.loadRepos(); // initalize it.. } return _RooTicket; } public Gee.ArrayList tickets; // only available for singletonn. - public Gee.ArrayList projects; // only available for singletonn. + public Gee.ArrayList repos; // only available for singletonn. public Gee.ArrayList milestones; @@ -141,18 +131,7 @@ public class RooTicket : Object GLib.debug("ADD ticket %s : %s : %s", add.id, add.summary, add.project_id_name); return add; } - public RooProject addProject(Json.Object t) - { - var add = new RooProject(); - add.id = t.get_string_member("id"); - add.name = t.get_string_member("name"); - add.type = t.get_string_member("type"); - add.code = t.get_string_member("code"); - this.projects.add(add); - GLib.debug("ADD project %s : %s : %s", add.id, add.code, add.name); - return add; - } - + public RooRepo addRepo(Json.Object t) { var add = new RooRepo(); @@ -172,9 +151,7 @@ public class RooTicket : Object if (rt.repos.size < 1) { rt.loadRepos(); } - if (rt.projects.size < 1) { - rt.loadProjects(); - } + var pid = ""; foreach(var roo_repo in rt.repos) { @@ -188,7 +165,7 @@ public class RooTicket : Object return null; } // get project by id... - foreach(var roo_project in rt.projects) { + foreach(var roo_project in RooProjects.projects()) { if (roo_project.id == pid) { GLib.debug("getProjectByRepo: project_id = %s", pid); return roo_project;