Skip to content

Commit 40e0894

Browse files
Merge pull request #228 from shikhar-sahay/starredPapers
fix:patched answer key button not working
2 parents 744299f + 13a772e commit 40e0894

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

src/components/CatalogueContent.tsx

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export async function downloadFile(url: string, filename: string) {
2323
link.download = filename;
2424
link.click();
2525
window.URL.revokeObjectURL(link.href);
26-
} catch (error) {}
26+
} catch (error) { }
2727
}
2828

2929
const CatalogueContent = () => {
@@ -76,7 +76,7 @@ const CatalogueContent = () => {
7676
try {
7777
const papersResponse = await axios.get<Filters>("/api/papers", {
7878
params: { subject },
79-
});
79+
});g
8080
const data: Filters = papersResponse.data;
8181
const papersData = data.papers;
8282
setFilterOptions(data);
@@ -99,7 +99,7 @@ const CatalogueContent = () => {
9999
? selectedCampuses.includes(paper.campus)
100100
: true;
101101
const answerkeyCondition = selectedAnswerKeyIncluded
102-
? paper.answerKeyIncluded
102+
? paper.answerKeyIncluded === true
103103
: true;
104104
return (
105105
examCondition &&
@@ -118,7 +118,7 @@ const CatalogueContent = () => {
118118
setError(
119119
axios.isAxiosError(axiosError)
120120
? ((axiosError.response?.data as { message?: string })?.message ??
121-
"Error fetching papers")
121+
"Error fetching papers")
122122
: "Error fetching papers",
123123
);
124124
} finally {
@@ -149,13 +149,21 @@ const CatalogueContent = () => {
149149
);
150150

151151
const handleDownloadAll = useCallback(async () => {
152+
/* if (typeof window !== "undefined" && window.gtag) {
153+
window.gtag("event", "download_all_clicked", {
154+
event_category: "Paper Downloads",
155+
event_label: "Download All Clicked",
156+
});
157+
} */
158+
152159
for (const paper of selectedPapers) {
153160
const extension = paper.finalUrl.split(".").pop();
154161
const fileName = `${extractBracketContent(paper.subject)}-${paper.exam}-${paper.slot}-${paper.year}.${extension}`;
155162
await downloadFile(paper.finalUrl, fileName);
156163
}
157164
}, [selectedPapers]);
158165

166+
159167
const handleApplyFilters = useCallback(
160168
(
161169
exams: string[],
@@ -198,7 +206,7 @@ const CatalogueContent = () => {
198206
const campusCondition = campus.length
199207
? campus.includes(paper.campus)
200208
: true;
201-
const answerkeyCondition = anskey ? paper.answerKeyIncluded : true;
209+
const answerkeyCondition = anskey ? paper.answerKeyIncluded === true : true;
202210
return (
203211
examCondition &&
204212
slotCondition &&

0 commit comments

Comments
 (0)