RooTicket.vala
authorAlan Knowles <alan@roojs.com>
Mon, 24 Dec 2018 06:58:10 +0000 (14:58 +0800)
committerAlan Knowles <alan@roojs.com>
Mon, 24 Dec 2018 06:58:10 +0000 (14:58 +0800)
RooTicket.vala

index 3d85401..4f2a52d 100644 (file)
@@ -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>();
-            _RooTicket.projects = new Gee.ArrayList<RooProject>();
             _RooTicket.repos = new Gee.ArrayList<RooRepo>();
             _RooTicket.loadRepos(); // initalize it..        
         }
         return _RooTicket;
     }
        public Gee.ArrayList<RooTicket> tickets; // only available for singletonn.
-       public Gee.ArrayList<RooProject> projects; // only available for singletonn.    
        public Gee.ArrayList<RooRepo> repos; // only available for singletonn.          
        
        public Gee.ArrayList<RooOption> 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;