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 "AVG(1.0 * {$field})";
64
        return "AVG(1.0 * {$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 column::TYPE_FLOAT;
-
 
75
    }
-
 
76
 
67
    /**
77
    /**
68
     * Return formatted value for column when applying aggregation
78
     * Return formatted value for column when applying aggregation
69
     *
79
     *
70
     * For boolean columns we return the average of the values (0..1), numeric columns execute original callbacks if present
80
     * For boolean columns we return the average of the values (0..1), numeric columns execute original callbacks if present
71
     *
81
     *
72
     * @param mixed $value
82
     * @param mixed $value
73
     * @param array $values
83
     * @param array $values
74
     * @param array $callbacks
84
     * @param array $callbacks
75
     * @param int $columntype
85
     * @param int $columntype
76
     * @return mixed
86
     * @return mixed
77
     */
87
     */
78
    public static function format_value($value, array $values, array $callbacks, int $columntype) {
88
    public function format_value($value, array $values, array $callbacks, int $columntype) {
79
        if (reset($values) === null) {
89
        if (reset($values) === null) {
80
            return null;
90
            return null;
81
        }
91
        }
82
        if ($columntype === column::TYPE_BOOLEAN || empty($callbacks)) {
92
        if ($columntype === column::TYPE_BOOLEAN || empty($callbacks)) {