Skip to content

Commit

Permalink
removed(client): disable ability to edit and save spool changes
Browse files Browse the repository at this point in the history
Editing needs a big overhaul to be usable. Bugs are currently happening due to spool editing. Will return the feature when editing is overhauled

Closes: #1217
  • Loading branch information
NotExpectedYet committed Oct 1, 2022
1 parent 548cc98 commit b584d74
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 63 deletions.
120 changes: 57 additions & 63 deletions client/entry/history.runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -1128,68 +1128,62 @@ class History {

averagePrintTime.value = Calc.generateTime(current.file.averagePrintTime);
lastPrintTime.value = Calc.generateTime(current.file.lastPrintTime);
// const toolsArray = [];
// if (!!current?.spools) {
// for (const [i, spool] of current.spools.entries()) {
// const sp = Object.keys(spool)[0];
// const spoolSelector = returnBigFilamentSelectorTemplate(i);
// toolsArray.push(sp);
// viewTable.insertAdjacentHTML(
// 'beforeend',
// `
// <tr>
// <td>
// ${spoolSelector}
// </td>
// <td>
// ${spool[sp]?.volume ? spool[sp]?.volume : 0}m3
// </td>
// <td>
// ${spool[sp]?.length ? spool[sp]?.length : 0}m
// </td>
// <td>
// ${spool[sp]?.weight ? spool[sp]?.weight : 0}g
// </td>
// <td>
// ${spool[sp]?.cost ? spool[sp]?.cost.toFixed(2) : 0}
// </td>
// </tr>
// </tr>
// `
// );
// await drawHistoryDropDown(
// document.getElementById(`tool-${i}-bigFilamentSelect`),
// spool[sp]?.spoolId
// );
// }
// } else {
// const spoolSelector = returnBigFilamentSelectorTemplate(0);
// toolsArray.push(0);
// viewTable.insertAdjacentHTML(
// 'beforeend',
// `
// <tr>
// <td>
// ${spoolSelector}
// </td>
// <td>
// 0m3
// </td>
// <td>
// 0m
// </td>
// <td>
// 0g
// </td>
// <td>
// 0
// </td>
// </tr>
// </tr>
// `
// );
// await drawHistoryDropDown(document.getElementById(`tool-0-bigFilamentSelect`), 0);
// }
const toolsArray = [];
if (!!current?.spools) {
for (const spool of current.spools) {
const sp = Object.keys(spool)[0];
toolsArray.push(sp);
viewTable.insertAdjacentHTML(
'beforeend',
`
<tr>
<td>
${!!spool[sp]?.toolName ? spool[sp]?.toolName : "0"}: ${!!spool[sp]?.spoolName ? spool[sp].spoolName : "No Spool"}
</td>
<td>
${!!spool[sp]?.volume ? spool[sp]?.volume : 0}m3
</td>
<td>
${!!spool[sp]?.length ? spool[sp]?.length : 0}m
</td>
<td>
${!!spool[sp]?.weight ? spool[sp]?.weight : 0}g
</td>
<td>
${!!spool[sp]?.cost ? spool[sp]?.cost : 0}
</td>
</tr>
</tr>
`
);

}
} else {
toolsArray.push(0);
viewTable.insertAdjacentHTML(
'beforeend',
`
<tr>
<td>
No Spool
</td>
<td>
0m3
</td>
<td>
0m
</td>
<td>
0g
</td>
<td>
0
</td>
</tr>
</tr>
`
);
}

viewTable.insertAdjacentHTML(
'beforeend',
Expand All @@ -1199,7 +1193,7 @@ class History {
Totals
</td>
<td>
${current.totalVolume.toFixed(2)}m3
${current.totalVolume.toFixed(4)}m3
</td>
<td>
${(current.totalLength / 1000).toFixed(4)}m
Expand Down
2 changes: 2 additions & 0 deletions server/routes/history.routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ router.post('/update', ensureAuthenticated, async (req, res) => {
if (history.printHistory.notes !== note) {
history.printHistory.notes = note;
}

for (let f = 0; f < filamentId.length; f++) {
if (Array.isArray(history.printHistory.filamentSelection)) {
if (
Expand All @@ -44,6 +45,7 @@ router.post('/update', ensureAuthenticated, async (req, res) => {
}
}
} else {
console.log(filamentId[f])
if (
history.printHistory.filamentSelection !== null &&
history.printHistory.filamentSelection._id == filamentId
Expand Down

0 comments on commit b584d74

Please sign in to comment.