Skip to content

Commit

Permalink
Code attempts
Browse files Browse the repository at this point in the history
  • Loading branch information
kalindudc committed Oct 13, 2021
1 parent 04af2ce commit f9b86b2
Show file tree
Hide file tree
Showing 9 changed files with 887 additions and 2 deletions.
512 changes: 512 additions & 0 deletions colors-text.txt

Large diffs are not rendered by default.

25 changes: 25 additions & 0 deletions colors.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
const data = require('./data.json');
const fs = require('fs');

var colours = []

console.log("\nSetting Colours...\n");

fs.readFile('./data.json', 'utf8', (err, jsonString) => {
if (err) {
console.log("File read failed:", err)
return
}

var data = JSON.parse(jsonString);
data.forEach(element => {
fs.appendFileSync('colors-text.txt', "\"color add " + element.name + " " + element.hexString + "\",\n");
});

})

console.log("\n------------------------------\n");
process.on('SIGINT', function() {
console.log("ok.");
process.exit();
});
1 change: 1 addition & 0 deletions data.json

Large diffs are not rendered by default.

86 changes: 86 additions & 0 deletions package-lock.json

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

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"cors": "^2.8.5",
"cryptr": "^6.0.1",
"csv-express": "^1.2.2",
"discord.js": "^12.2.0",
"dotenv": "^8.2.0",
"express": "^4.17.1",
"express-session": "^1.17.0",
Expand Down
8 changes: 6 additions & 2 deletions stats.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ Data.getProblems((err, data) => {
// user, problem, problempt attemp #, user attempt #, elapsed/attempt, attempt start time, user type, submitted

var startTime = new Date(new Date('2019-12-02T15:31:03.036Z').getTime() - (20*1000));

var timePrev = 0;
item.attempts.forEach((attempt, j) => {
// finalData.push({
// user: item.email,
Expand All @@ -84,14 +86,16 @@ Data.getProblems((err, data) => {
[d.getHours(),
d.getMinutes(),
d.getSeconds()].join(':');

var line = item.email + ',' +
'Q' + problems[item.id].index + ':'+ problems[item.id].name + ',' +
j + ',' +
attempt.elapsedTime + ',' +
dformat + ',' +
validUsers[item.email].type + ',' +
item.complete + "\n";
item.complete + "," +
attempt.code + "," +
attempt.output + "\n";

fs.appendFileSync(fileName, line);
});
Expand Down
Loading

0 comments on commit f9b86b2

Please sign in to comment.