Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add extra course information from banner web #1

Open
buiminh1995 opened this issue Feb 7, 2022 · 2 comments
Open

add extra course information from banner web #1

buiminh1995 opened this issue Feb 7, 2022 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@buiminh1995
Copy link
Contributor

No information for courses as of now
Screen Shot 2022-02-07 at 4 15 34 PM

@buiminh1995 buiminh1995 added the enhancement New feature or request label Feb 7, 2022
@buiminh1995 buiminh1995 self-assigned this Feb 7, 2022
@ndemarchis
Copy link
Member

Definitely check out updateCourses/nightly.js. Specifically here:

const updateCoursePreReqs = (term, deptCode, courseNumber) => {
return fetch(`https://banner.ban.bucknell.edu/prodssb/bwckctlg.p_disp_course_detail?cat_term_in=${term}&subj_code_in=${deptCode}&crse_numb_in=${courseNumber}`, {
"headers": {
"accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9",
"accept-language": "en-US,en;q=0.9",
"cache-control": "max-age=0",
"sec-ch-ua": "\" Not A;Brand\";v=\"99\", \"Chromium\";v=\"96\", \"Microsoft Edge\";v=\"96\"",
"sec-ch-ua-mobile": "?0",
"sec-ch-ua-platform": "\"Windows\"",
"sec-fetch-dest": "document",
"sec-fetch-mode": "navigate",
"sec-fetch-site": "same-site",
"sec-fetch-user": "?1",
"upgrade-insecure-requests": "1"
},
"referrer": "https://pubapps.bucknell.edu/",
"referrerPolicy": "strict-origin-when-cross-origin",
"body": null,
"method": "GET",
"mode": "cors",
"credentials": "include"
}).then((response) => response.text())
.then((data) => {
delay(500).then(() => {
let v = data.match(/Prerequisites: <\/SPAN>\n<br \/>\n(.*?)\n<br \/>/g)
if (v) {
let a = v.join('').replace("\n", "").replace(/<[^>]*>/g, '')
// console.log(a)
return a;
} else { return ""; }
})
});
}
const updateSectionInfo = (term, crn, deptCode) => {
return fetch(`https://banner.ban.bucknell.edu/prodssb/hwzkdpac.P_Bucknell_CGUpdate?formopt=VIEWSECT&term=${term}&updsubj=${deptCode}&crn=${crn}&viewterm=${term}`, {
"headers": {
"accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9",
"accept-language": "en-US,en;q=0.9",
"cache-control": "max-age=0",
"sec-ch-ua": "\" Not A;Brand\";v=\"99\", \"Chromium\";v=\"96\", \"Microsoft Edge\";v=\"96\"",
"sec-ch-ua-mobile": "?0",
"sec-ch-ua-platform": "\"Windows\"",
"sec-fetch-dest": "document",
"sec-fetch-mode": "navigate",
"sec-fetch-site": "same-site",
"sec-fetch-user": "?1",
"upgrade-insecure-requests": "1"
},
"referrer": "https://pubapps.bucknell.edu/",
"referrerPolicy": "strict-origin-when-cross-origin",
"body": null,
"method": "GET",
"mode": "cors",
"credentials": "include"
}).then((res) => res.text())
.then((data) => {
let match1 = /<th CLASS="ddlabel" scope="row" >General Course Objectives:<\/th>\n<td CLASS="dddefault">(?<Objectives>([\s\S]*))<\/td>\n<\/tr>\n<tr>\n<th CLASS="ddlabel" scope="row" >Description of Subject Matter:<\/th>\n<td CLASS="dddefault">(?<Description>([\s\S]*))<\/td>\n<\/tr>\n<tr>\n<th CLASS="ddlabel" scope="row" >Method of Instruction and Study:/g;
return match1.exec(data)
})
}

@ndemarchis
Copy link
Member

update on this: new code that I've pushed has removed the redundant "unused" keyword. if data is implemented, should join the list as shown below:

<List dense={true} className="w-full">
{(unselectedSectionTypes.length > 0) && (
<Alert severity="warning">Select sections for the {unselectedSectionTypes.map(i => courseAliasesIcons[i].type).join(", ").replace(/, ([^,]*)$/, ' and $1')} of this course.</Alert>
)}
{/* something else */}
{(Object.keys(course.sections).length > 1) ? (

i.e., is "something else" to be implemented. datatype should either be <ListItem /> or <ListItemButton />. this would likely work well for information such as prerequisites, seats filled (if 1-section course), etc.

If a lot of info (i.e., full description) is to be displayed, implement a dropdown ListItemButton with a <Collapse />. This is implemented in both CourseCard.js and ListItem.js.

@ndemarchis ndemarchis changed the title Add course information add extra course information from banner web Feb 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants