Skip to content

Commit a5369e3

Browse files
Fixed an issue relating to tables of scraped course codes being cut in half by page break (#34)
Co-authored-by: b2stickman <b2stickman@gmail.com>
1 parent 3db95e0 commit a5369e3

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

my-app/src/presenters/UploadTranscriptPresenter.jsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const UploadTranscriptPresenter = observer(({ model }) => {
1313
const [fileInputValue, setFileInputValue] = useState(""); // Controls upload field state
1414

1515
async function transcriptScraperFunction(file) {
16-
console.log(file);
16+
//console.log(file);
1717
//const pdfjsLib = window['pdfjsLib'];
1818
//pdfjsLib.GlobalWorkerOptions.workerSrc = 'https://cdnjs.cloudflare.com/ajax/libs/pdf.js/2.16.105/pdf.worker.min.js';
1919
if (!file) {
@@ -80,7 +80,7 @@ const UploadTranscriptPresenter = observer(({ model }) => {
8080

8181

8282
localStorage.setItem("completedCourses", JSON.stringify(newcodes));
83-
console.log(newcodes);
83+
//console.log(newcodes);
8484

8585
window.dispatchEvent(new Event("completedCourses changed"));
8686
}
@@ -125,7 +125,10 @@ const UploadTranscriptPresenter = observer(({ model }) => {
125125
if (!flagTableDone) {
126126
flagTable = true;
127127
} else {
128-
if (textObjects[i - 2].transform[4] !== 497.66899718999997) {
128+
if ((textObjects[i - 1].transform[4] !== 532.71801758)&&(textObjects[i - 11].transform[4] !== 532.71801758)) {
129+
//if its i-1, the page number is the object directly behind, otherwise if -11 its because theres some filter,
130+
//e.g. utskrift datum, personnummer and others. hopefully this should cover all base (probably doesn't)
131+
//this is a very hardcoded solution to this problem.
129132
//the new table (that is the new found "Kod" / "Code" is not because unexpected page break, therefore we are done transcribing
130133
//KTH courses, these are either uncomplete courses, or courses from other universities
131134
flagTable = false;

0 commit comments

Comments
 (0)