Skip to content

Commit

Permalink
Use config to locate source data
Browse files Browse the repository at this point in the history
  • Loading branch information
Elanis committed Apr 30, 2022
1 parent 65fafc1 commit 4383baf
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions main.server.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import fs from 'fs';
const folder = 'G:\\Lumen\\resources\\app\\data\\focus-stats\\';

const tags = JSON.parse(fs.readFileSync(folder + 'tags.json'));
const history = JSON.parse(fs.readFileSync(folder + 'history.json'));
const tags = JSON.parse(fs.readFileSync(config['focus-stats']['dataFolder'] + 'tags.json'));
const history = JSON.parse(fs.readFileSync(config['focus-stats']['dataFolder'] + 'history.json'));

export default class FocusStats {
static init() {
Expand All @@ -23,7 +22,7 @@ export default class FocusStats {
dbEntriesMapped[dbEntry.date.getTime()] = dbEntry;
}

const history = JSON.parse(fs.readFileSync(folder + 'history.json'));
const history = JSON.parse(fs.readFileSync(config['focus-stats']['dataFolder'] + 'history.json'));
for(const name in history) {
for(const exe in history[name]) {
if(name === '' && exe === '') {
Expand Down Expand Up @@ -73,7 +72,7 @@ export default class FocusStats {
// We won't do it now because there's now way to remove tags from UI atm

// Insert tags
const tags = JSON.parse(fs.readFileSync(folder + 'tags.json'));
const tags = JSON.parse(fs.readFileSync(config['focus-stats']['dataFolder'] + 'tags.json'));
for(const name in tags) {
for(const exe in tags[name]) {
for(const tag of tags[name][exe]) {
Expand Down

0 comments on commit 4383baf

Please sign in to comment.