Last active
January 6, 2018 14:33
-
-
Save micromaomao/93f0e9ae62584c55f1bf50cfef92d10b to your computer and use it in GitHub Desktop.
Check paper completeness for SchSrch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fetch('/subjects/?as=json').then(res => res.json()).then(subjs => { | |
function doSubject(i) { | |
if (i >= subjs.length) return void console.log('# Done!') | |
let subj = subjs[i] | |
console.log('# Doing ' + subj._id + '...') | |
checkSubject(subj).then(() => { doSubject(i + 1) }) | |
} | |
function checkSubject (subj) { | |
return Promise.all(subj.times | |
.map(time => checkEr(subj._id, time).then(b => Promise.resolve([time, b])))) | |
.then(arr => Promise.resolve(arr.filter(x => !x[1] && x[0][0] !== 'y'))).then(arr => { | |
for (let [t, b] of arr) console.log(subj._id + ' ' + t) | |
return Promise.resolve() | |
}) | |
} | |
function checkEr (subject, time) { | |
return fetch(`/search/?query=${encodeURIComponent(subject + ' ' + time + ' er')}&as=json`).then(res => res.json()).then(({list}) => Promise.resolve(!!list.find(x => x.type === 'er'))) | |
.catch(err => Promise.reject(void console.error(`Error doing checkEr for ${subject} ${time}: ${err.toString()}`))) | |
} | |
doSubject(0) | |
}) | |
/* | |
# Doing 9707... | |
9707 w11 x | |
9707 w15 w | |
# Doing 9701... | |
9701 w16 w | |
9701 m17 w | |
9701 s17 w | |
# Doing 9700... | |
9700 w16 w | |
9700 m17 w | |
9700 s17 w | |
# Doing 9699... | |
9699 w11 x | |
# Doing 9702... | |
9702 w16 w | |
9702 m17 w | |
9702 s17 w | |
# Doing 9697... | |
9697 w11 x | |
# Doing 9609... | |
9609 m16 w | |
9609 w16 w | |
9609 m17 w | |
9609 s17 w | |
# Doing 9709... | |
9709 m17 w | |
9709 s17 w | |
# Doing 9389... | |
9389 w16 w | |
9389 s17 w | |
# Doing 0509... | |
# Doing 0500... | |
0500 w14 w | |
0500 w15 w | |
0500 m16 w | |
0500 w16 w | |
0500 m17 w | |
0500 s17 w | |
# Doing 0522... | |
0522 w15 w | |
0522 s16 w | |
0522 w16 w | |
0522 s17 w | |
# Doing 0620... | |
0620 w15 w | |
0620 s16 w | |
0620 w16 w | |
0620 m17 w | |
0620 s17 w | |
# Doing 0470... | |
0470 s02 x | |
0470 w16 w | |
0470 m17 w | |
# Doing 9708... | |
9708 s02 x | |
9708 m16 w | |
9708 w16 w | |
9708 m17 w | |
9708 s17 w | |
# Doing 0460... | |
0460 w11 x | |
0460 w16 (no from CIE) | |
0460 s17 w | |
# Doing 0495... | |
0495 w14 w | |
0495 s15 w | |
# Doing 0486... | |
0486 w14 w | |
0486 w15 w | |
0486 m16 w | |
0486 s16 w | |
0486 w16 w | |
0486 m17 w | |
0486 s17 w | |
# Doing 0400... | |
0400 w14 w | |
0400 w15 w | |
0400 w16 w | |
0400 s17 w | |
# Doing 0410... | |
0410 w11 x | |
0410 w14 w | |
# Doing 0452... | |
0452 m16 (no from CIE) | |
0452 w16 w | |
0452 s17 w | |
# Doing 0511... | |
0511 w15 w | |
0511 s16 w | |
0511 w16 w | |
# Doing 0530... | |
0530 w11 x | |
0530 w14 w | |
0530 w15 w | |
0530 s16 w | |
0530 w16 w | |
# Doing 9231... | |
9231 w11 x | |
# Doing 0580... | |
0580 w15 w | |
0580 m16 w | |
0580 s16 w | |
0580 w16 w | |
0580 m17 w | |
0580 s17 w | |
# Doing 8681... | |
# Doing 0606... | |
0606 w11 x | |
0606 m15 (no from CIE) | |
0606 w16 w | |
0606 m17 w | |
0606 s17 (no from CIE) | |
# Doing 9239... | |
# Doing 0610... | |
0610 s14 w | |
0610 w15 w | |
0610 m16 w | |
0610 s16 w | |
0610 w16 w | |
0610 m17 w | |
0610 s17 w | |
# Doing 9715... | |
# Doing 0625... | |
0625 s14 w | |
0625 w14 w | |
0625 w15 w | |
0625 m16 w | |
0625 s16 w | |
0625 w16 w | |
0625 m17 w | |
0625 s17 w | |
# Doing 0450... | |
0450 w14 w | |
0450 s15 w | |
0450 w15 w | |
0450 m16 w | |
0450 s16 w | |
0450 w16 w | |
0450 s17 w | |
# Doing 8987... | |
8987 w14 x | |
8987 s15 x | |
# Done! | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment