Completed
Push — master ( a0cdb4...020e9d )
by Angus
03:19
created
application/models/Tracker/Tracker_Title_Model.php 1 patch
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -15,11 +15,11 @@  discard block
 block discarded – undo
15 15
 	 */
16 16
 	public function getID(string $titleURL, int $siteID, bool $create = TRUE, bool $returnData = FALSE) {
17 17
 		$query = $this->db->select('tracker_titles.id, tracker_titles.title, tracker_titles.title_url, tracker_titles.latest_chapter, tracker_titles.status, tracker_sites.site_class, (tracker_titles.last_checked > DATE_SUB(NOW(), INTERVAL 3 DAY)) AS active', FALSE)
18
-		                  ->from('tracker_titles')
19
-		                  ->join('tracker_sites', 'tracker_sites.id = tracker_titles.site_id', 'left')
20
-		                  ->where('tracker_titles.title_url', $titleURL)
21
-		                  ->where('tracker_titles.site_id', $siteID)
22
-		                  ->get();
18
+						  ->from('tracker_titles')
19
+						  ->join('tracker_sites', 'tracker_sites.id = tracker_titles.site_id', 'left')
20
+						  ->where('tracker_titles.title_url', $titleURL)
21
+						  ->where('tracker_titles.site_id', $siteID)
22
+						  ->get();
23 23
 
24 24
 		if($query->num_rows() > 0) {
25 25
 			$id = (int) $query->row('id');
@@ -32,8 +32,8 @@  discard block
 block discarded – undo
32 32
 						//Make sure last_checked is always updated on successful run.
33 33
 						//CHECK: Is there a reason we aren't just doing this in updateTitleById?
34 34
 						$this->db->set('last_checked', 'CURRENT_TIMESTAMP', FALSE)
35
-						         ->where('id', $id)
36
-						         ->update('tracker_titles');
35
+								 ->where('id', $id)
36
+								 ->update('tracker_titles');
37 37
 					}
38 38
 				} else {
39 39
 					log_message('error', "{$query->row('title')} failed to update successfully");
@@ -73,9 +73,9 @@  discard block
 block discarded – undo
73 73
 	 */
74 74
 	private function addTitle(string $titleURL, int $siteID) : int {
75 75
 		$query = $this->db->select('site, site_class')
76
-		                  ->from('tracker_sites')
77
-		                  ->where('id', $siteID)
78
-		                  ->get();
76
+						  ->from('tracker_sites')
77
+						  ->where('id', $siteID)
78
+						  ->get();
79 79
 
80 80
 		$titleData = $this->sites->{$query->row()->site_class}->getTitleData($titleURL, TRUE);
81 81
 
@@ -101,19 +101,19 @@  discard block
 block discarded – undo
101 101
 	public function updateByID(int $titleID, string $latestChapter) : bool {
102 102
 		//FIXME: Really not too happy with how we're doing history stuff here, it just feels messy.
103 103
 		$query = $this->db->select('latest_chapter AS current_chapter')
104
-		                  ->from('tracker_titles')
105
-		                  ->where('id', $titleID)
106
-		                  ->get();
104
+						  ->from('tracker_titles')
105
+						  ->where('id', $titleID)
106
+						  ->get();
107 107
 		$row = $query->row();
108 108
 
109 109
 		$success = $this->db->set(['latest_chapter' => $latestChapter]) //last_updated gets updated via a trigger if something changes
110
-		                    ->where('id', $titleID)
111
-		                    ->update('tracker_titles');
110
+							->where('id', $titleID)
111
+							->update('tracker_titles');
112 112
 
113 113
 		//Clear hidden latest chapter
114 114
 		$this->db->set(['ignore_chapter' => 'NULL', 'last_updated' => 'last_updated'], NULL, FALSE)
115
-		         ->where('title_id', $titleID)
116
-		         ->update('tracker_chapters');
115
+				 ->where('title_id', $titleID)
116
+				 ->update('tracker_chapters');
117 117
 
118 118
 		//Update History
119 119
 		//NOTE: To avoid doing another query to grab the last_updated time, we just use time() which <should> get the same thing.
@@ -131,9 +131,9 @@  discard block
 block discarded – undo
131 131
 	 */
132 132
 	public function getSiteDataFromURL(string $site_url) {
133 133
 		$query = $this->db->select('*')
134
-		                  ->from('tracker_sites')
135
-		                  ->where('site', $site_url)
136
-		                  ->get();
134
+						  ->from('tracker_sites')
135
+						  ->where('site', $site_url)
136
+						  ->get();
137 137
 
138 138
 		return $query->row();
139 139
 	}
Please login to merge, or discard this patch.
application/models/Tracker/Tracker_List_Model.php 1 patch
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -165,14 +165,14 @@  discard block
 block discarded – undo
165 165
 			}
166 166
 
167 167
 			$idQuery = $this->db->select('id')
168
-			                    ->where('user_id', $userID)
169
-			                    ->where('title_id', $titleID)
170
-			                    ->get('tracker_chapters');
168
+								->where('user_id', $userID)
169
+								->where('title_id', $titleID)
170
+								->get('tracker_chapters');
171 171
 			if($idQuery->num_rows() > 0) {
172 172
 				$success = (bool) $this->db->set(['current_chapter' => $chapter, 'active' => 'Y', 'last_updated' => NULL, 'ignore_chapter' => NULL])
173
-				                           ->where('user_id', $userID)
174
-				                           ->where('title_id', $titleID)
175
-				                           ->update('tracker_chapters');
173
+										   ->where('user_id', $userID)
174
+										   ->where('title_id', $titleID)
175
+										   ->update('tracker_chapters');
176 176
 
177 177
 				if($success) {
178 178
 					$idQueryRow = $idQuery->row();
@@ -198,9 +198,9 @@  discard block
 block discarded – undo
198 198
 	}
199 199
 	public function updateByID(int $userID, int $chapterID, string $chapter) : bool {
200 200
 		$success = (bool) $this->db->set(['current_chapter' => $chapter, 'active' => 'Y', 'last_updated' => NULL])
201
-		                           ->where('user_id', $userID)
202
-		                           ->where('id', $chapterID)
203
-		                           ->update('tracker_chapters');
201
+								   ->where('user_id', $userID)
202
+								   ->where('id', $chapterID)
203
+								   ->update('tracker_chapters');
204 204
 
205 205
 		if($success) {
206 206
 			$this->History->userUpdateTitle($chapterID, $chapter);
@@ -211,9 +211,9 @@  discard block
 block discarded – undo
211 211
 
212 212
 	public function ignoreByID(int $userID, int $chapterID, string $chapter) : bool {
213 213
 		$success = (bool) $this->db->set(['ignore_chapter' => $chapter, 'active' => 'Y', 'last_updated' => NULL])
214
-		                           ->where('user_id', $userID)
215
-		                           ->where('id', $chapterID)
216
-		                           ->update('tracker_chapters');
214
+								   ->where('user_id', $userID)
215
+								   ->where('id', $chapterID)
216
+								   ->update('tracker_chapters');
217 217
 
218 218
 		if($success) {
219 219
 			$this->History->userIgnoreTitle($chapterID, $chapter);
@@ -226,9 +226,9 @@  discard block
 block discarded – undo
226 226
 		//This is to allow user history to function properly.
227 227
 
228 228
 		$success = $this->db->set(['active' => 'N', 'last_updated' => NULL])
229
-		                    ->where('user_id', $userID)
230
-		                    ->where('id', $chapterID)
231
-		                    ->update('tracker_chapters');
229
+							->where('user_id', $userID)
230
+							->where('id', $chapterID)
231
+							->update('tracker_chapters');
232 232
 
233 233
 		return (bool) $success;
234 234
 	}
Please login to merge, or discard this patch.