Skip to content

Commit

Permalink
Minor patch
Browse files Browse the repository at this point in the history
Made some changes to the way accomplishments section is extracted. No more node existence dependency.
The details of each accomplishment section is directly extracted.
Still not long term fix for the extraction tool however.
  • Loading branch information
DrakenWan committed Dec 8, 2021
1 parent 415b8d3 commit a49de63
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 29 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ Currently able to extract:-
* - [ ] `volunteer experience`
* - [x] `skills section`
* - [ ] `accomplishments`
* - [x] `courses` _bug has been fixed in v1.1.1 temporary-patch_
* - [ ] `projects`
* - [x] `courses`
* - [x] `projects`
* - [ ] `languages`
* - [ ] `test scores`
* - [ ] `awards`
64 changes: 37 additions & 27 deletions scripts/content.js
Original file line number Diff line number Diff line change
Expand Up @@ -317,34 +317,44 @@ function extract() {
/// Languages, honor-awards)

//first, extract out the array of nodes containing different sections
var acc_nodes = document.querySelectorAll(".pv-accomplishments-section > div")
if(acc_nodes.length != 0) {//check accomplishments nodelist length is not 0
var course_nodes = acc_nodes[0].querySelectorAll("div > ul > li");
var project_nodes = acc_nodes[1].querySelectorAll("div > ul > li");
var lang_nodes = acc_nodes[2].querySelectorAll("div > ul > li");
var tests = acc_nodes[3].querySelectorAll("div > ul > li");
var awards = acc_nodes[4].querySelectorAll("div > ul > li");

///extracting different sections starting with course section

/////COURSES/////
var courses = []
if(course_nodes) { //if course_nodes exists

for(var nodo of course_nodes) {
var courseName = nodo.textContent;
courses.push(
getCleanText(courseName)
);
}
var coursesection = document.querySelector(".courses")
var projectsection = document.querySelector(".projects");
// var lang_nodes = acc_nodes[2]?.querySelectorAll("div > ul > li") || null;
// var tests = acc_nodes[3]?.querySelectorAll("div > ul > li") || null;
// var awards = acc_nodes[4]?.querySelectorAll("div > ul > li") || null;

///extracting different sections starting with course section

/////COURSES/////
var courses = []
if(coursesection) { //if coursesection exists
var course_nodes = coursesection.querySelectorAll("div > ul > li") || null;
for(var nodo of course_nodes) {
var courseName = nodo.textContent;
courses.push(
getCleanText(courseName)
);
}
}
/////COURSES EXTRACTION ENDS HERE/////


var accomplishments = {
courses: courses || []
}
}
/////COURSES EXTRACTION ENDS HERE/////

/////PROJECTS////
var projects = []
if(projectsection) {
var project_nodes = projectsection.querySelectorAll("div > ul > li") || null;
for(var nodo of project_nodes) {
var projectName = nodo.textContent;
projects.push(
getCleanText(projectName)
);
}
}
/////PROJECTS EXTRACTION ENDS HERE////

var accomplishments = {
"courses": courses || [],
"projects": projects || []
}

////Accomplishments extraction ends here

Expand Down

0 comments on commit a49de63

Please sign in to comment.