Code Duplication    Length = 8-12 lines in 3 locations

application/models/task_model.php 3 locations

@@ 1240-1247 (lines=8) @@
1237
			}
1238
1239
			//If it's the first item, set the status of the task to "In progress"
1240
			if($is_first == TRUE)
1241
			{
1242
				$this->db->set('status', 3)
1243
					->where('id', $task_id)
1244
					->update('item');
1245
1246
				return ($this->db->affected_rows() > 0) ? "first" : -1;
1247
			}
1248
1249
			if($is_last == TRUE) //set status to "Completed"
1250
			{
@@ 1249-1260 (lines=12) @@
1246
				return ($this->db->affected_rows() > 0) ? "first" : -1;
1247
			}
1248
1249
			if($is_last == TRUE) //set status to "Completed"
1250
			{
1251
				$this->db->set('status', 2)
1252
					->where('id', $task_id)
1253
					->update('item');
1254
1255
				return ($this->db->affected_rows() > 0) ? "last" : -1;
1256
			}
1257
			else
1258
			{
1259
				return 1;
1260
			}
1261
1262
		}
1263
		else if($checked == 0) //Unchecking a checkbox
@@ 1276-1283 (lines=8) @@
1273
				return PERM_NO_ACCESS;
1274
1275
			//if unchecking the last item, set status as "In progress"
1276
			if($is_last == TRUE)
1277
			{
1278
				$this->db->set('status', 3)
1279
					->where('id', $task_id)
1280
					->update('item');
1281
1282
				return ($this->db->affected_rows() > 0) ? "first" : -1;
1283
			}
1284
		}
1285
	}
1286