<?php
if (!defined('BASEPATH'))
    exit('No direct script access allowed');
/**
 * 
 *
 * @author Ulaleka
 */
class Dashboard_model extends CI_Model {

    public function overallSatisfaction() {
        try {
            $sql = "SELECT sum(satisfaction) sum,ROUND(avg(satisfaction),1) avg,count(id) Count FROM activity;";
            $result = $this->db->query($sql)->result();
            $this->db->close();
            return $result;
        } catch (Exception $exc) {
            return [];
        }
    }
    
    public function departmentVsEmp() {
        try {
            $sql = "select department,count(empId) Count from emp_info group by department order by count(empId)";
            $result = $this->db->query($sql)->result();
            $this->db->close();
            return $result;
        } catch (Exception $exc) {
            return [];
        }
    }

}
