Raffael-Kultyshev commited on
Commit
6352cc2
·
1 Parent(s): fb66e8f

FIX: episode_chunk was hardcoded to 0, now reads from info.episodes or calculates dynamically

Browse files

BUG: const episode_chunk = Math.floor(0 / 1000) was ALWAYS 0
FIX: Get chunk from info.episodes array OR calculate as episodeId / chunks_size

This fixes 404 errors for episodes 100+ which are in chunk-001

src/app/[org]/[dataset]/[episode]/fetch-data.ts CHANGED
@@ -84,7 +84,9 @@ export async function getAdjacentEpisodesVideoInfo(
84
  videosInfo = extractVideoInfoV3WithSegmentation(repoId, version, info, episodeMetadata);
85
  } else {
86
  // For v2.x, use simpler video info extraction
87
- const episode_chunk = Math.floor(0 / 1000);
 
 
88
  videosInfo = Object.entries(info.features)
89
  .filter(([, value]) => value.dtype === "video")
90
  .map(([key]) => {
@@ -121,7 +123,9 @@ async function getEpisodeDataV2(
121
  info: DatasetMetadata,
122
  episodeId: number,
123
  ) {
124
- const episode_chunk = Math.floor(0 / 1000);
 
 
125
 
126
  // Dataset information
127
  const datasetInfo = {
 
84
  videosInfo = extractVideoInfoV3WithSegmentation(repoId, version, info, episodeMetadata);
85
  } else {
86
  // For v2.x, use simpler video info extraction
87
+ // FIX: Get episode_chunk from info.episodes or calculate dynamically
88
+ const episodeInfoAdj = (info as any).episodes?.find((ep: any) => ep.episode_index === episodeId);
89
+ const episode_chunk = episodeInfoAdj?.episode_chunk ?? Math.floor(episodeId / (info.chunks_size || 1000));
90
  videosInfo = Object.entries(info.features)
91
  .filter(([, value]) => value.dtype === "video")
92
  .map(([key]) => {
 
123
  info: DatasetMetadata,
124
  episodeId: number,
125
  ) {
126
+ // FIX: Get episode_chunk from info.episodes array (like Python backend) or calculate dynamically
127
+ const episodeInfoFromMeta = (info as any).episodes?.find((ep: any) => ep.episode_index === episodeId);
128
+ const episode_chunk = episodeInfoFromMeta?.episode_chunk ?? Math.floor(episodeId / (info.chunks_size || 1000));
129
 
130
  // Dataset information
131
  const datasetInfo = {