Skip to content

Commit 49851cf

Browse files
ShaughnShaughn
authored andcommitted
tweaks
1 parent c9f8606 commit 49851cf

File tree

3 files changed

+4
-1037
lines changed

3 files changed

+4
-1037
lines changed

index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ <h1>ILR File Creator</h1>
1010

1111
<form id="uploadForm">
1212
<label>releaseVersion</label>
13-
<input type="text" id =releaseVersion>
13+
<input type="text" id =releaseVersion required>
1414
<br>
1515
<label>CSV File</label>
1616
<input type="file" id="csvFile" accept=".csv" required>

main.js

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// const {xsd} = require("./schema-for-validate")
21
const xmllint = require('xmllint');
32
const { app, BrowserWindow, ipcMain, globalShortcut, dialog, shell } = require("electron");
43
const path = require("node:path");
@@ -19,7 +18,7 @@ process.on('uncaughtException', (error) => {
1918
log.error('Uncaught Exception:', error);
2019
});
2120

22-
const tempDir = path.join(os.tmpdir(), `electron-${app.name}-xmls`);
21+
const tempDir = path.join(os.tmpdir(), `electron-ilr_file_creator-xmls`);
2322
let XMLfilePath = ""
2423
let versionForExport = ""
2524
const formatDateTime = (date) => {
@@ -89,22 +88,7 @@ app.whenReady().then(() => {
8988

9089
ipcMain.on("upload-csv", (event, dataArray, version) => {
9190
try {
92-
versionForExport = version
93-
if (dataArray.some((learner, learnerIndex) =>
94-
learner.some((item, index) => {
95-
let exceptionIndices = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192,193];
96-
if (item === "" && !exceptionIndices.includes(index)) {
97-
const missingField = dataArray[0][index] || `Field at index ${index}`;
98-
event.reply('show-alert', `Data missing: ${missingField} for learner ${learnerIndex}`);
99-
return true;
100-
}
101-
return false;
102-
})
103-
)) {
104-
event.reply('show-alert', 'Please fill in all required fields');
105-
}
106-
else{
107-
// test this works and require it
91+
versionForExport = version
10892
xmlBase.Header.Source.Release = version
10993
xmlBase.Header.CollectionDetails.Year = version.split('.')[0];
11094
let refNumber = 0
@@ -557,7 +541,7 @@ worker.on('exit', (code) => {
557541

558542

559543

560-
}
544+
561545
} catch (error) {
562546
console.error("An error occurred during XML validation:", error);
563547
}

0 commit comments

Comments
 (0)