diff options
| author | horus | 2020-03-15 02:19:42 +0100 |
|---|---|---|
| committer | horus | 2020-03-15 02:19:42 +0100 |
| commit | 571609509e35b9ea6fa3eba0afa9a3427cde606b (patch) | |
| tree | adcbab60be8c7d87c17c6b7ade745eacd34ad840 /app/Libraries/Helper.php | |
| parent | ede718cd123415078dd37fe216979f7270a66037 (diff) | |
| download | senpai-571609509e35b9ea6fa3eba0afa9a3427cde606b.tar.gz | |
Bugfix: Update watched episodes.
Diffstat (limited to 'app/Libraries/Helper.php')
| -rw-r--r-- | app/Libraries/Helper.php | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/app/Libraries/Helper.php b/app/Libraries/Helper.php index 7d89b2c..0cc21bf 100644 --- a/app/Libraries/Helper.php +++ b/app/Libraries/Helper.php @@ -114,6 +114,20 @@ class Helper { ->exists(); if ( $check ) { $actually_watching[] = $anime_details["mal_id"]; + + /** + * Update watched episodes. + */ + $check_watched_episodes = DB::table('is_watching') + ->where('mal_id', $anime_details["mal_id"]) + ->where('user_id', $user->id) + ->get('episodes_watched')[0]; + if ( $check_watched_episodes->episodes_watched != $anime_details["episodes_watched"] ) { + DB::update('UPDATE is_watching SET episodes_watched = ? WHERE mal_id = ? AND user_id = ?', + [ $anime_details["episodes_watched"], $anime_details["mal_id"], $user->id] ); + + } + continue; } $anime = Anime::where('mal_id', $anime_details["mal_id"])->get()->first(); |
