Skip to content

Commit

Permalink
Merge pull request #2 from rohald89/main
Browse files Browse the repository at this point in the history
Update requirements display
  • Loading branch information
dustinusey authored Mar 5, 2024
2 parents d9818c4 + ad72491 commit e90c7ea
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 21 deletions.
29 changes: 19 additions & 10 deletions frontend/dist/scripts/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,6 @@ function loadProjectList(id) {
fetch(PROJECTS_URL)
.then(response => response.json())
.then(data => {
console.log(data.result)
populate(data.result, id)
})

Expand Down Expand Up @@ -359,7 +358,6 @@ tdList.addEventListener('click', e => {
fetch(SINGLE_PROJECT_URL)
.then(response => response.json())
.then(data => {
console.log(data.result);
loadProjectRequirements(data.result);
})
}
Expand Down Expand Up @@ -814,13 +812,14 @@ function buildReview() {
div.appendChild(icon2);
li.appendChild(div);
let req = document.createElement('span');
req.textContent = item.textContent;
const requirement = item.querySelector('.sub-requirements-title');
req.textContent = requirement.textContent;
li.appendChild(req);
correctItemsList.appendChild(li);
});

// building questionable items
gradedData.questionableItems.forEach(item => {
gradedData.questionableItems.forEach(item => {
let li = document.createElement('li');
li.classList = 'questioned';
const div1 = document.createElement('div');
Expand All @@ -832,7 +831,8 @@ function buildReview() {
const div2 = document.createElement('div2');
div2.classList.add('req-content');
let req = document.createElement('span');
req.textContent = item.req.textContent;
const requirement = item.req.querySelector('.sub-requirements-title');
req.textContent = requirement.textContent;
div2.appendChild(req);
if (item.text !== '') {
let customText = document.createElement('p');
Expand All @@ -845,6 +845,7 @@ function buildReview() {

// building incorrect items
gradedData.incorrectItems.forEach(item => {
console.log(item)
let li = document.createElement('li');
li.classList = 'incorrect';
const div1 = document.createElement('div');
Expand All @@ -856,7 +857,9 @@ function buildReview() {
const div2 = document.createElement('div2');
div2.classList.add('req-content');
let req = document.createElement('span');
req.textContent = item.req.textContent;
console.log(item)
const requirement = item.req.querySelector('.sub-requirements-title');
req.textContent = requirement.textContent;
div2.appendChild(req);
if (item.text !== '') {
let customText = document.createElement('p');
Expand Down Expand Up @@ -1020,22 +1023,28 @@ function copySlackMessage() {

if (toggle_correct.classList.contains('active')) {
gradedData.correctItems.meets.forEach(item => {
secretTextarea.value += `:meets: ${item.textContent}\n`
const requirement = item.querySelector('.sub-requirements-title');
secretTextarea.value += `:meets: ${requirement.textContent}\n`
});
gradedData.correctItems.exceeds.forEach(item => {
secretTextarea.value += `:meets: :exceeds: ${item.textContent}\n`
const requirement = item.querySelector('.sub-requirements-title');
secretTextarea.value += `:meets: :exceeds: ${requirement.textContent}\n`
})
secretTextarea.value += `\n`
}
if (toggle_question.classList.contains('active')) {
gradedData.questionableItems.forEach(item => {
secretTextarea.value += `:questioned: ${item.req.textContent}\n> ${item.text}\n`
const requirement = item.req.querySelector('.sub-requirements-title');
const isExceeds = item.req.classList.contains('exceeds-item');
secretTextarea.value += `:questioned: ${isExceeds && ":exceeds:"} ${requirement.textContent}\n> ${item.text}\n`
})
secretTextarea.value += `\n`
}
if (toggle_wrong.classList.contains('active')) {
gradedData.incorrectItems.forEach(item => {
secretTextarea.value += `:needs-work: ${item.req.textContent}\n> ${item.text}\n`
const requirement = item.req.querySelector('.sub-requirements-title');
const isExceeds = item.req.classList.contains('exceeds-item');
secretTextarea.value += `:needs-work: ${isExceeds && ":exceeds:"} ${requirement.textContent}\n> ${item.text}\n`
})
}

Expand Down
27 changes: 17 additions & 10 deletions frontend/src/scripts/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,6 @@ function loadProjectList(id) {
fetch(PROJECTS_URL)
.then(response => response.json())
.then(data => {
console.log(data.result)
populate(data.result, id)
})

Expand Down Expand Up @@ -359,7 +358,6 @@ tdList.addEventListener('click', e => {
fetch(SINGLE_PROJECT_URL)
.then(response => response.json())
.then(data => {
console.log(data.result);
loadProjectRequirements(data.result);
})
}
Expand Down Expand Up @@ -814,13 +812,14 @@ function buildReview() {
div.appendChild(icon2);
li.appendChild(div);
let req = document.createElement('span');
req.textContent = item.textContent;
const requirement = item.querySelector('.sub-requirements-title');
req.textContent = requirement.textContent;
li.appendChild(req);
correctItemsList.appendChild(li);
});

// building questionable items
gradedData.questionableItems.forEach(item => {
gradedData.questionableItems.forEach(item => {
let li = document.createElement('li');
li.classList = 'questioned';
const div1 = document.createElement('div');
Expand All @@ -832,7 +831,8 @@ function buildReview() {
const div2 = document.createElement('div2');
div2.classList.add('req-content');
let req = document.createElement('span');
req.textContent = item.req.textContent;
const requirement = item.req.querySelector('.sub-requirements-title');
req.textContent = requirement.textContent;
div2.appendChild(req);
if (item.text !== '') {
let customText = document.createElement('p');
Expand All @@ -856,7 +856,8 @@ function buildReview() {
const div2 = document.createElement('div2');
div2.classList.add('req-content');
let req = document.createElement('span');
req.textContent = item.req.textContent;
const requirement = item.req.querySelector('.sub-requirements-title');
req.textContent = requirement.textContent;
div2.appendChild(req);
if (item.text !== '') {
let customText = document.createElement('p');
Expand Down Expand Up @@ -1020,22 +1021,28 @@ function copySlackMessage() {

if (toggle_correct.classList.contains('active')) {
gradedData.correctItems.meets.forEach(item => {
secretTextarea.value += `:meets: ${item.textContent}\n`
const requirement = item.querySelector('.sub-requirements-title');
secretTextarea.value += `:meets: ${requirement.textContent}\n`
});
gradedData.correctItems.exceeds.forEach(item => {
secretTextarea.value += `:meets: :exceeds: ${item.textContent}\n`
const requirement = item.querySelector('.sub-requirements-title');
secretTextarea.value += `:meets: :exceeds: ${requirement.textContent}\n`
})
secretTextarea.value += `\n`
}
if (toggle_question.classList.contains('active')) {
gradedData.questionableItems.forEach(item => {
secretTextarea.value += `:questioned: ${item.req.textContent}\n> ${item.text}\n`
const requirement = item.req.querySelector('.sub-requirements-title');
const isExceeds = item.req.classList.contains('exceeds-item');
secretTextarea.value += `:questioned: ${isExceeds && ":exceeds:"} ${requirement.textContent}\n> ${item.text}\n`
})
secretTextarea.value += `\n`
}
if (toggle_wrong.classList.contains('active')) {
gradedData.incorrectItems.forEach(item => {
secretTextarea.value += `:needs-work: ${item.req.textContent}\n> ${item.text}\n`
const requirement = item.req.querySelector('.sub-requirements-title');
const isExceeds = item.req.classList.contains('exceeds-item');
secretTextarea.value += `:needs-work: ${isExceeds && ":exceeds:"} ${requirement.textContent}\n> ${item.text}\n`
})
}

Expand Down
3 changes: 2 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit e90c7ea

Please sign in to comment.