Esempio n. 1
0
    public PrepareEventGraphReactionTime(double time, int sessionID, int personID, string table, string type)
    {
        Sqlite.Open();

        //obtain data
        rtsAtSQL = SqliteReactionTime.SelectReactionTimes(true, sessionID, personID, type,
                                                          Sqlite.Orders_by.ID_DESC, 10); //select only last 10

        personMAXAtSQL = SqliteSession.SelectMAXEventsOfAType(
            true, sessionID, personID, table, type, "time");
        sessionMAXAtSQL = SqliteSession.SelectMAXEventsOfAType(
            true, sessionID, -1, table, type, "time");

        personMINAtSQL = SqliteSession.SelectMINEventsOfAType(
            true, sessionID, personID, table, type, "time");
        sessionMINAtSQL = SqliteSession.SelectMINEventsOfAType(
            true, sessionID, -1, table, type, "time");

        personAVGAtSQL = SqliteSession.SelectAVGEventsOfAType(
            true, sessionID, personID, table, type, "time");
        sessionAVGAtSQL = SqliteSession.SelectAVGEventsOfAType(
            true, sessionID, -1, table, type, "time");

        Sqlite.Close();

        this.time = time;
    }
Esempio n. 2
0
    public PrepareEventGraphRunSimple(double time, double speed, int sessionID, int personID, string table, string type)
    {
        Sqlite.Open();

        //obtain data
        runsAtSQL = SqliteRun.SelectRuns(true, sessionID, personID, type,
                                         Sqlite.Orders_by.ID_DESC, 10); //select only last 10


        string sqlSelect = "distance/time";

        personMAXAtSQLAllSessions = SqliteSession.SelectMAXEventsOfAType(true, -1, personID, table, type, sqlSelect);
        personMAXAtSQL            = SqliteSession.SelectMAXEventsOfAType(true, sessionID, personID, table, type, sqlSelect);
        sessionMAXAtSQL           = SqliteSession.SelectMAXEventsOfAType(true, sessionID, -1, table, type, sqlSelect);

        //distancePersonAVGAtSQL = SqliteSession.SelectAVGEventsOfAType(true, sessionID, personID, table, type, "distance");
        //distanceSessionAVGAtSQL = SqliteSession.SelectAVGEventsOfAType(true, sessionID, -1, table, type, "distance");
        //better to know speed like:
        //SELECT AVG(distance/time) from run; than
        //SELECT AVG(distance) / SELECT AVG(time)
        //first is ok, because is the speed AVG
        //2nd is not good because it tries to do an AVG of all distances and times
        personAVGAtSQL  = SqliteSession.SelectAVGEventsOfAType(true, sessionID, personID, table, type, sqlSelect);
        sessionAVGAtSQL = SqliteSession.SelectAVGEventsOfAType(true, sessionID, -1, table, type, sqlSelect);

        this.time  = time;
        this.speed = speed;

        Sqlite.Close();
    }
Esempio n. 3
0
    public PrepareEventGraphJumpSimple(double tv, double tc, int sessionID, int personID, string table, string type)
    {
        Sqlite.Open();

        //select data from SQL to update graph
        jumpsAtSQL = SqliteJump.SelectJumps(true, sessionID, personID, "", type,
                                            Sqlite.Orders_by.ID_DESC, 10); //select only last 10

        string sqlSelect = "";

        if (tv > 0)
        {
            if (tc <= 0)
            {
                sqlSelect = "100*4.9*(TV/2)*(TV/2)";
            }
            else
            {
                sqlSelect = "TV";                 //if tc is higher than tv it will be fixed on PrepareJumpSimpleGraph
            }
        }
        else
        {
            sqlSelect = "TC";
        }

        personMAXAtSQLAllSessions = SqliteSession.SelectMAXEventsOfAType(true, -1, personID, table, type, sqlSelect);
        personMAXAtSQL            = SqliteSession.SelectMAXEventsOfAType(true, sessionID, personID, table, type, sqlSelect);
        sessionMAXAtSQL           = SqliteSession.SelectMAXEventsOfAType(true, sessionID, -1, table, type, sqlSelect);

        personAVGAtSQL  = SqliteSession.SelectAVGEventsOfAType(true, sessionID, personID, table, type, sqlSelect);
        sessionAVGAtSQL = SqliteSession.SelectAVGEventsOfAType(true, sessionID, -1, table, type, sqlSelect);

        //end of select data from SQL to update graph

        this.tv = tv;
        this.tc = tc;

        Sqlite.Close();
    }