Code Duplication    Length = 8-12 lines in 3 locations

application/models/task_model.php 3 locations

@@ 1227-1234 (lines=8) @@
1224
			}
1225
1226
			//If it's the first item, set the status of the task to "In progress"
1227
			if($is_first == TRUE)
1228
			{
1229
				$this->db->set('status', 3)
1230
					->where('id', $task_id)
1231
					->update('item');
1232
1233
				return ($this->db->affected_rows() > 0) ? "first" : -1;
1234
			}
1235
1236
			if($is_last == TRUE) //set status to "Completed"
1237
			{
@@ 1236-1247 (lines=12) @@
1233
				return ($this->db->affected_rows() > 0) ? "first" : -1;
1234
			}
1235
1236
			if($is_last == TRUE) //set status to "Completed"
1237
			{
1238
				$this->db->set('status', 2)
1239
					->where('id', $task_id)
1240
					->update('item');
1241
1242
				return ($this->db->affected_rows() > 0) ? "last" : -1;
1243
			}
1244
			else
1245
			{
1246
				return 1;
1247
			}
1248
1249
		}
1250
		else if($checked == 0) //Unchecking a checkbox
@@ 1263-1270 (lines=8) @@
1260
				return PERM_NO_ACCESS;
1261
1262
			//if unchecking the last item, set status as "In progress"
1263
			if($is_last == TRUE)
1264
			{
1265
				$this->db->set('status', 3)
1266
					->where('id', $task_id)
1267
					->update('item');
1268
1269
				return ($this->db->affected_rows() > 0) ? "first" : -1;
1270
			}
1271
		}
1272
	}
1273