Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
xgirma committed Aug 14, 2020
1 parent 4de7cdb commit e37ab5c
Show file tree
Hide file tree
Showing 14 changed files with 1,337 additions and 1,866 deletions.
27 changes: 1 addition & 26 deletions chart/referrers/count.json
Original file line number Diff line number Diff line change
@@ -1,26 +1 @@
[
{
"name": "twicli.neocat.jp",
"value": 1
},
{
"name": "lib4dev.in",
"value": 8
},
{
"name": "t.co",
"value": 49
},
{
"name": "medium.com",
"value": 54
},
{
"name": "Google",
"value": 88
},
{
"name": "github.com",
"value": 325
}
]
[]
2 changes: 1 addition & 1 deletion chart/referrers/count.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
27 changes: 1 addition & 26 deletions chart/referrers/unique.json
Original file line number Diff line number Diff line change
@@ -1,26 +1 @@
[
{
"name": "lib4dev.in",
"value": 1
},
{
"name": "twicli.neocat.jp",
"value": 1
},
{
"name": "medium.com",
"value": 24
},
{
"name": "t.co",
"value": 41
},
{
"name": "Google",
"value": 46
},
{
"name": "github.com",
"value": 142
}
]
[]
2 changes: 1 addition & 1 deletion chart/referrers/unique.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file added chart/views.js
Empty file.
3 changes: 3 additions & 0 deletions chart/views/views.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
name,count,uniques
name,count,uniques
name,count,uniques
45 changes: 45 additions & 0 deletions chart/views_sample.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import { logger } from "../src/constants";

const { appendFileSync, writeFileSync } = require("fs");

function writeToFile(header, data) {
const content = ["name,count,uniques"];
const file = "chart/views/views.csv";

data.forEach((element) => content.push(element));

writeFileSync(file, "", "utf8");

try {
content.forEach((line) => {
appendFileSync(file, `${line}\n`, "utf8");
});
} catch (error) {
console.error("Error writing csv to file");
}
}

function createCSv() {
try {
const redacted = require(`../data/redacted/redacted.json`);
const data = [];

redacted.forEach( r => {
const { views, name } = r;
const { count, uniques } = views;
if( count == 0 && uniques == 0) {
data.push(`${r.name},${r.views.count},${r.views.uniques}`);
}
});

console.log(data);


writeToFile();

} catch (error) {
logger.error(error.message);
}
}

createCSv();
Loading

0 comments on commit e37ab5c

Please sign in to comment.