mirror of
https://github.com/madari-media/madari-oss.git
synced 2026-04-21 19:21:56 +00:00
hotfix: added clamp
Some checks are pending
Build and Deploy / build_windows (push) Waiting to run
Build and Deploy / build_android (push) Waiting to run
Build and Deploy / build_android_tv (push) Waiting to run
Build and Deploy / build_ipa (push) Waiting to run
Build and Deploy / build_linux (push) Waiting to run
Build and Deploy / build_macos (push) Waiting to run
Some checks are pending
Build and Deploy / build_windows (push) Waiting to run
Build and Deploy / build_android (push) Waiting to run
Build and Deploy / build_android_tv (push) Waiting to run
Build and Deploy / build_ipa (push) Waiting to run
Build and Deploy / build_linux (push) Waiting to run
Build and Deploy / build_macos (push) Waiting to run
This commit is contained in:
parent
2be343b276
commit
00bb20999c
1 changed files with 48 additions and 12 deletions
|
|
@ -304,8 +304,14 @@ class TraktService {
|
||||||
'$_baseUrl/sync/watched/shows',
|
'$_baseUrl/sync/watched/shows',
|
||||||
);
|
);
|
||||||
|
|
||||||
final startIndex = (page - 1) * itemsPerPage;
|
if (watchedShows.isEmpty) {
|
||||||
final endIndex = startIndex + itemsPerPage;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final startIndex =
|
||||||
|
((page - 1) * itemsPerPage).clamp(0, watchedShows.length - 1);
|
||||||
|
final endIndex =
|
||||||
|
(startIndex + itemsPerPage).clamp(0, watchedShows.length - 1);
|
||||||
|
|
||||||
final items = watchedShows.toList();
|
final items = watchedShows.toList();
|
||||||
|
|
||||||
|
|
@ -459,11 +465,17 @@ class TraktService {
|
||||||
final List<dynamic> continueWatching =
|
final List<dynamic> continueWatching =
|
||||||
await _makeRequest('$_baseUrl/sync/playback');
|
await _makeRequest('$_baseUrl/sync/playback');
|
||||||
|
|
||||||
|
if (continueWatching.isEmpty) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
continueWatching.sort((v2, v1) => DateTime.parse(v1["paused_at"])
|
continueWatching.sort((v2, v1) => DateTime.parse(v1["paused_at"])
|
||||||
.compareTo(DateTime.parse(v2["paused_at"])));
|
.compareTo(DateTime.parse(v2["paused_at"])));
|
||||||
|
|
||||||
final startIndex = (page - 1) * itemsPerPage;
|
final startIndex =
|
||||||
final endIndex = startIndex + itemsPerPage;
|
((page - 1) * itemsPerPage).clamp(0, continueWatching.length - 1);
|
||||||
|
final endIndex =
|
||||||
|
(startIndex + itemsPerPage).clamp(0, continueWatching.length - 1);
|
||||||
|
|
||||||
if (startIndex >= continueWatching.length) {
|
if (startIndex >= continueWatching.length) {
|
||||||
return [];
|
return [];
|
||||||
|
|
@ -541,8 +553,14 @@ class TraktService {
|
||||||
'$_baseUrl/calendars/my/shows/${DateFormat('yyyy-MM-dd').format(DateTime.now())}/7',
|
'$_baseUrl/calendars/my/shows/${DateFormat('yyyy-MM-dd').format(DateTime.now())}/7',
|
||||||
);
|
);
|
||||||
|
|
||||||
final startIndex = (page - 1) * itemsPerPage;
|
if (scheduleShows.isEmpty) {
|
||||||
final endIndex = startIndex + itemsPerPage;
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
final startIndex =
|
||||||
|
((page - 1) * itemsPerPage).clamp(0, scheduleShows.length - 1);
|
||||||
|
final endIndex =
|
||||||
|
(startIndex + itemsPerPage).clamp(0, scheduleShows.length - 1);
|
||||||
|
|
||||||
if (startIndex >= scheduleShows.length) {
|
if (startIndex >= scheduleShows.length) {
|
||||||
return [];
|
return [];
|
||||||
|
|
@ -602,8 +620,14 @@ class TraktService {
|
||||||
await _makeRequest('$_baseUrl/sync/watchlist');
|
await _makeRequest('$_baseUrl/sync/watchlist');
|
||||||
_logger.info('Got watchlist');
|
_logger.info('Got watchlist');
|
||||||
|
|
||||||
final startIndex = (page - 1) * itemsPerPage;
|
if (watchlistItems.isEmpty) {
|
||||||
final endIndex = startIndex + itemsPerPage;
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
final startIndex =
|
||||||
|
((page - 1) * itemsPerPage).clamp(0, watchlistItems.length - 1);
|
||||||
|
final endIndex =
|
||||||
|
(startIndex + itemsPerPage).clamp(0, watchlistItems.length - 1);
|
||||||
|
|
||||||
if (startIndex >= watchlistItems.length) {
|
if (startIndex >= watchlistItems.length) {
|
||||||
return [];
|
return [];
|
||||||
|
|
@ -666,8 +690,14 @@ class TraktService {
|
||||||
'$_baseUrl/recommendations/shows',
|
'$_baseUrl/recommendations/shows',
|
||||||
);
|
);
|
||||||
|
|
||||||
final startIndex = (page - 1) * itemsPerPage;
|
if (recommendedShows.isEmpty) {
|
||||||
final endIndex = startIndex + itemsPerPage;
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
final startIndex =
|
||||||
|
((page - 1) * itemsPerPage).clamp(0, recommendedShows.length - 1);
|
||||||
|
final endIndex =
|
||||||
|
(startIndex + itemsPerPage).clamp(0, recommendedShows.length - 1);
|
||||||
|
|
||||||
if (startIndex >= recommendedShows.length) {
|
if (startIndex >= recommendedShows.length) {
|
||||||
return [];
|
return [];
|
||||||
|
|
@ -717,8 +747,14 @@ class TraktService {
|
||||||
'$_baseUrl/recommendations/movies',
|
'$_baseUrl/recommendations/movies',
|
||||||
);
|
);
|
||||||
|
|
||||||
final startIndex = (page - 1) * itemsPerPage;
|
if (recommendedMovies.isEmpty) {
|
||||||
final endIndex = startIndex + itemsPerPage;
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
final startIndex =
|
||||||
|
((page - 1) * itemsPerPage).clamp(0, recommendedMovies.length - 1);
|
||||||
|
final endIndex =
|
||||||
|
(startIndex + itemsPerPage).clamp(0, recommendedMovies.length - 1);
|
||||||
|
|
||||||
if (startIndex >= recommendedMovies.length) {
|
if (startIndex >= recommendedMovies.length) {
|
||||||
return [];
|
return [];
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue