Proyectos de Subversion Moodle

Rev

Rev 1 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 1 Rev 1441
Línea 63... Línea 63...
63
    public static function get_field_sql(string $field, int $columntype): string {
63
    public static function get_field_sql(string $field, int $columntype): string {
64
        return "SUM({$field})";
64
        return "SUM({$field})";
65
    }
65
    }
Línea 66... Línea 66...
66
 
66
 
-
 
67
    /**
-
 
68
     * Returns aggregated column type
-
 
69
     *
-
 
70
     * @param int $columntype
-
 
71
     * @return int
-
 
72
     */
-
 
73
    public static function get_column_type(int $columntype): int {
-
 
74
        return match ($columntype) {
-
 
75
            column::TYPE_FLOAT => column::TYPE_FLOAT,
-
 
76
            default => column::TYPE_INTEGER,
-
 
77
        };
-
 
78
    }
-
 
79
 
67
    /**
80
    /**
68
     * Return formatted value for column when applying aggregation
81
     * Return formatted value for column when applying aggregation
69
     *
82
     *
70
     * For boolean columns we return the sum of the true values, numeric columns execute original callbacks if present
83
     * For boolean columns we return the sum of the true values, numeric columns execute original callbacks if present
71
     *
84
     *
72
     * @param mixed $value
85
     * @param mixed $value
73
     * @param array $values
86
     * @param array $values
74
     * @param array $callbacks
87
     * @param array $callbacks
75
     * @param int $columntype
88
     * @param int $columntype
76
     * @return mixed
89
     * @return mixed
77
     */
90
     */
78
    public static function format_value($value, array $values, array $callbacks, int $columntype) {
91
    public function format_value($value, array $values, array $callbacks, int $columntype) {
79
        $firstvalue = reset($values);
92
        $firstvalue = reset($values);
80
        if ($firstvalue === null) {
93
        if ($firstvalue === null) {
81
            return null;
94
            return null;
82
        }
95
        }