Make model->update() generic

We want to update all fields. Not just the progress
This commit is contained in:
Karsten Heiken
2011-08-25 21:32:38 +02:00
parent e4d7dec284
commit 49587fd7ff

View File

@@ -47,19 +47,13 @@ class Job extends CI_Model {
} }
/** /**
* Update the progress of a given job. * Update the details of a given job.
* *
* @param string $job_id The job's id you want to update. * @param string $job_id The job's id you want to update.
* @param integer $progress The progress of the job. * @param integer $data The data of the job.
*/ */
public function update($job_id, $progress) { public function update($job_id, $data) {
$finished_at = ""; return $this->db->where('id', $job_id)->update('jobs', $data);
if($progress == 100)
$finished_at = ", `finished_at`=NOW()";
$this->db->query("UPDATE `jobs` SET `progress`=".
$this->db->escape($progress).$finished_at. " WHERE `id`=".
$this->db->escape($job_id));
} }
/** /**