{"size": 1378, "ext": "js", "max_stars_repo_path": "tomato-web/src/model/log.js", "max_stars_repo_name": "maxiloEmmmm/tomato", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "tomato-web/src/model/log.js", "max_issues_repo_name": "maxiloEmmmm/tomato", "max_issues_repo_issues_event_min_datetime": "2020-10-03T09:08:15.000Z", "max_issues_repo_issues_event_max_datetime": "2022-02-27T07:42:27.000Z", "max_forks_repo_path": "tomato-web/src/model/log.js", "max_forks_repo_name": "maxiloEmmmm/tomato", "max_forks_repo_forks_event_min_datetime": "2022-03-25T08:41:19.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-25T08:41:19.000Z"}
{"max_stars_count": null, "max_issues_count": 7, "max_forks_count": 1, "avg_line_length": 28.7083333333, "max_line_length": 96, "alphanum_fraction": 0.4564586357}
import maxiloVue from "maxilo-vue"
import * as logType from "config/log"
function log() {
    this.RestTime = async () => {
        let db = await maxiloVue.make("db")
        return db.iquery(`
            select 
                case when ceil(t1.value / 60) == 0 then 1 else ceil(t1.value / 60) end  AS time,
                count(1) as total
            from 
                log as s 
                left join log_info as t1 on s.id = t1.log_id and t1.key = 'current'
            where
                action='${logType.RestEnd}'
            group by time
        `)
    }

    this.TomatoTime = async () => {
        let db = await maxiloVue.make("db")
        return db.iquery(`
            SELECT
                case when ceil(t1.value / 60) == 0 then 1 else ceil(t1.value / 60) end AS time,
                count( 1 ) AS total 
            FROM
                log AS s
                LEFT JOIN log_info AS t1 ON s.id = t1.log_id AND t1.KEY = 'current' 
            WHERE
                ACTION = '${logType.TomatoEnd}' 
            GROUP BY
                time
        `)
    }

    this.Count = async () => {
        let db = await maxiloVue.make("db")
        return db.iquery(`
            select 
                action,
                count(1) as count
            from 
                log 
            group by action
        `)
    }
}

export default log