Conversation
Implement auto-filling of clipId by matching lecture dates with recording dates.
|
|
||
| useEffect(() => { | ||
| if (!courseId || !instanceId) return; | ||
| fetch(`/api/course-metadata/get-lecture?courseId=${courseId}&instanceId=${instanceId}`) |
There was a problem hiding this comment.
We dont use fetch. axios is more convenient.
| const fileData = fs.readFileSync(filePath, 'utf-8'); | ||
| existingData = JSON.parse(fileData); | ||
| } | ||
| const backupDir = path.join(process.env.RECORDED_SYLLABUS_DIR!, 'backups'); |
|
|
||
| const CoverageUpdateTab = ({ instanceId }: CoverageUpdateTabProps) => { | ||
| const router = useRouter(); | ||
| const courseId = router.query.courseId as string; |
There was a problem hiding this comment.
courseId is being fetched from the router query. Why do you need the instanceId to be passed on as a prop?
Both apporaches are fine but better to be consistent
| const [timezone, setTimezone] = useState<string | undefined>(undefined); | ||
|
|
||
| const [notCoveredSections, setNotCoveredSections] = useState<string[]>([]); | ||
| const [clips, setClips] = useState<any[]>([]); |
There was a problem hiding this comment.
dont use 'any'. Use proper types
|
|
||
| const fetchAllClips = async () => { | ||
| try { | ||
| const res = await axios.get(`/api/get-fau-series-clips/${seriesId}`); |
There was a problem hiding this comment.
We almost always create API 'spec' and dont make the API call directly. Do you know why?
|
|
||
| useEffect(() => { | ||
| if (!courseId || !instanceId) return; | ||
| fetch(`/api/course-metadata/get-lecture?courseId=${courseId}&instanceId=${instanceId}`) |
There was a problem hiding this comment.
Why fetch series id here when it is only used it the child component?
| useEffect(() => { | ||
| if (!seriesId || clips.length === 0) return; | ||
|
|
||
| const lectureDate = dayjs(formData.timestamp_ms).format('YYYY-MM-DD'); |
There was a problem hiding this comment.
Why do you need the same code in 2 places? Here and in handleEditDialogOpen ?
| } | ||
|
|
||
| async function getSeriesClipsCached(seriesId: string) { | ||
| const cachedInfo = CACHED_SERIES_CLIPS.get(seriesId); |
There was a problem hiding this comment.
Why did you choose this kind of caching?
Is it better to create a new API that caches fau.tv clips API instead of calling clips API directly from frontend (and perhaps using tanstack query for caching)?
Implement auto-filling of clipId by matching lecture dates with recording dates.