Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

rafaeladi's avatar

Counting pass,fail and total

So currently ive been working on a project and this is one of the problem that i had. I want to have this data in my application and want the data to be viewed as a progressbar in my view. I want the data to be like this

| CaseName  | Duration | VerdictPass  | VerdictFail | Total | Config |
| --------- | -------- | ------------ | ----------- | ----- | ------ |
|  Case1  |  3654  |  2  |  1  |  3  | BaseConfig_GEN1,ColorGrip_Absent,InkType_MO70 |
|  Case2  |  23325 |  1  |  0  |  1  | BaseConfig_GEN1,ColorGrip_Present|
|  Case3  |  23325 |  1  |  1  |  2  | BaseConfig_GEN2 |

Currently i only have this and the data is not even correct, especially the total

| CaseName  | Duration | Total  | Config |
| --------- | -------- | ------ | ------ | ----- |
|  Case1  |  3654  |  2  | BaseConfig_GEN1,ColorGrip_Absent,InkType_MO70 |
|  Case2  |  23325 |  1  | BaseConfig_GEN1,ColorGrip_Present|
|  Case3  |  23325 |  2  | BaseConfig_GEN2 |

As of now, i havent figured out how to generate the VerdictPass and Fail in the same query.

My current query now

    public function testSuiteDetails($suite_id)
    {
        return DB::table('test_executions as e')
        ->select('e.case_id','b.version','c.name as case',DB::raw('SUM(distinct e.duration) as time'),
            DB::raw('group_concat(distinct bs.config order by bs.config asc SEPARATOR ";") as config'))
        ->selectRaw('COUNT(distinct e.verdict) as verdict')
        ->rightJoin('test_cases as c','e.case_id','=','c.id')
        ->rightJoin('test_suites as s','c.suite_id','=','s.id')
        ->rightJoin('build_versions as b','e.build_id','=','b.id')
        ->rightJoin('configuration as f','f.id','=','e.finalconfig_id')
        ->rightJoin('baseconfig_configuration as bc','bc.config_id','=','f.id')
        ->rightJoin('base_config as bs','bs.id','=','bc.baseconfig_id')
        ->groupBy('e.case_id','b.version','c.name')
        ->where('c.suite_id',$suite_id)
        ->get();

    }

Is there anyway to get this right? Please note that the configuration retrieved from other table and concatenate inside this query. Down below also i gave my DB schema to better investigate the problem

DB Schema

0 likes
4 replies

Please or to participate in this conversation.