@axium/kino 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -53,9 +53,13 @@ addRoute({
53
53
  ])
54
54
  .where('kino_tv_views.userId', '=', userId)
55
55
  .orderBy('kino_tv_views.viewedAt', 'desc')
56
- .limit(limit)
56
+ // Only one row per show survives the dedupe below, so fetch extra to avoid a short list
57
+ .limit(limit * 4)
57
58
  .execute(),
58
59
  ]);
60
+ /** A show should take one slot no matter how many of its episodes were watched */
61
+ const seenShows = new Set();
62
+ const latestPerShow = episodes.filter(row => !seenShows.has(row.showId) && seenShows.add(row.showId));
59
63
  const views = [
60
64
  ...movies.map(({ viewedAt, position, duration, uploadedAt, uploadName, size, type, ...movie }) => ({
61
65
  type: 'movie',
@@ -64,7 +68,7 @@ addRoute({
64
68
  duration,
65
69
  movie: { ...movie, upload: { uploadedAt, name: uploadName, size, type } },
66
70
  })),
67
- ...episodes.map(row => ({
71
+ ...latestPerShow.map(row => ({
68
72
  type: 'tv',
69
73
  viewedAt: row.viewedAt,
70
74
  position: row.position,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@axium/kino",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "author": "James Prevett <axium@jamespre.dev>",
5
5
  "description": "Movies and TV for Axium",
6
6
  "funding": {