text
stringlengths
0
234
-- ------------------------------
overriding
function Get_Row (From : in Ticket_Report_Bean) return Util.Beans.Objects.Object is
begin
return From.Row;
end Get_Row;
-- ------------------------------
-- Load the information for the tickets.
-- ------------------------------
overriding
procedure Load (Bean : in out Ticket_Report_Bean;
Outcome : in out Ada.Strings.Unbounded.Unbounded_String) is
pragma Unreferenced (Outcome);
Session : constant ADO.Sessions.Session := Bean.Module.Get_Session;
Query : ADO.Queries.Context;
Empty : constant Jason.Tickets.Models.Stat_Bean := (Kind => Models.WORK,
others => 0);
Ctx : constant ASC.Service_Context_Access := ASC.Current;
User : constant AWA.Users.Models.User_Ref := Ctx.Get_User;
begin
Query.Set_Query (Jason.Tickets.Models.Query_Stats);
Query.Bind_Param ("project_id", Bean.Project.Get_Id);
Query.Bind_Param ("user_id", User.Get_Id);
ADO.Sessions.Entities.Bind_Param (Params => Query,
Name => "project_table",
Table => Jason.Projects.Models.PROJECT_TABLE,
Session => Session);
declare
Stmt : ADO.Statements.Query_Statement := Session.Create_Statement (Query);
begin
Stmt.Execute;
while Stmt.Has_Elements loop
declare
use Models;
Status : constant Models.Status_Type := Status_Type'Val (Stmt.Get_Integer (0));
Kind : constant Models.Ticket_Type := Ticket_Type'Val (Stmt.Get_Integer (1));
Priority : constant Natural := Stmt.Get_Integer (2);
Count : constant Natural := Stmt.Get_Integer (3);
Time : constant Natural := Stmt.Get_Integer (4);
Done : constant Natural := Stmt.Get_Integer (5);
Remain : constant Natural := Stmt.Get_Integer (6);
procedure Update (Key : in Models.Ticket_Type;
Item : in out Ticket_Stat_Bean);
procedure Update (Key : in Models.Ticket_Type;
Item : in out Ticket_Stat_Bean) is
pragma Unreferenced (Key);
begin
if Status = Models.CLOSED or Status = Models.REJECTED then
Item.Closed.Count := Item.Closed.Count + Count;
Item.Closed.Time := Item.Closed.Time + Time;
Item.Closed.Done := Item.Closed.Done + Done;
Item.Closed.Remain := Item.Closed.Remain + Remain;
elsif Priority <= 3 then
Item.High.Count := Item.High.Count + Count;
Item.High.Time := Item.High.Time + Time;
Item.High.Done := Item.High.Done + Done;
Item.High.Remain := Item.High.Remain + Remain;
elsif Priority > 4 then
Item.Low.Count := Item.Low.Count + Count;
Item.Low.Time := Item.Low.Time + Time;
Item.Low.Done := Item.Low.Done + Done;
Item.Low.Remain := Item.Low.Remain + Remain;
else
Item.Medium.Count := Item.Medium.Count + Count;
Item.Medium.Time := Item.Medium.Time + Time;
Item.Medium.Done := Item.Medium.Done + Done;
Item.Medium.Remain := Item.Medium.Remain + Remain;
end if;
end Update;
Pos : constant Ticket_Stat_Map.Cursor := Bean.List.Find (Kind);
begin
if Ticket_Stat_Map.Has_Element (Pos) then
Bean.List.Update_Element (Pos, Update'Access);
else
declare
T : Ticket_Stat_Bean;
begin
T.Kind := Kind;
T.Count := 0;
T.Time := 0;
T.Remain := 0;
T.High := Empty;
T.Low := Empty;
T.Medium := Empty;
T.Closed := Empty;
Update (Kind, T);
Bean.List.Insert (Kind, T);
Function Definition: procedure Set_Field_Discrete is
Function Body: new ADO.Objects.Set_Field_Operation
(Status_Type);
Impl : Ticket_Access;
begin
Set_Field (Object, Impl);