From 49587fd7ffd29d907a5a4c90341c5f2f554febc0 Mon Sep 17 00:00:00 2001 From: Karsten Heiken Date: Thu, 25 Aug 2011 21:32:38 +0200 Subject: [PATCH] Make model->update() generic We want to update all fields. Not just the progress --- application/models/job.php | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/application/models/job.php b/application/models/job.php index 253cbcf..532720f 100644 --- a/application/models/job.php +++ b/application/models/job.php @@ -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 integer $progress The progress of the job. + * @param integer $data The data of the job. */ - public function update($job_id, $progress) { - $finished_at = ""; - 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)); + public function update($job_id, $data) { + return $this->db->where('id', $job_id)->update('jobs', $data); } /**