Skip to content

Commit

Permalink
add dev mode
Browse files Browse the repository at this point in the history
  • Loading branch information
Nickwasused committed Feb 25, 2023
1 parent f03a531 commit 688a172
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
3 changes: 2 additions & 1 deletion deno.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"tasks": {
"run": "deno run --allow-write --allow-net='tankstellenfinder.aral.de' index.ts"
"run": "deno run --allow-write --allow-net='tankstellenfinder.aral.de' index.ts",
"dev": "deno run --allow-write --allow-net='tankstellenfinder.aral.de' index.ts dev"
},
"fmt": {
"files": {
Expand Down
16 changes: 14 additions & 2 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ async function get_nearest(lat: number, long: number): Promise<stationdata[]> {
}
}

const is_dev: boolean = Deno.args[0] == 'dev';

type stationdata = {
id: string;
name: string;
Expand All @@ -30,11 +32,21 @@ type stationdata = {
website?: string;
};

let a = 47.2701,
b = 55.0583,
c = 5.8655,
d = 15.0419;

if (is_dev) {
console.log('using dev mode');
a = 47.2701, b = 48, c = 5.8655, d = 6.5;
}

async function get_all_stations(): Promise<stationdata[]> {
let station_data: stationdata[] = [];
// latitude and longitude are the bounds of germany
for (let i = 47.2701; i < 55.0583; i = i + 0.2) {
for (let x = 5.8655; x < 15.0419; x = x + 0.2) {
for (let i = a; i < b; i = i + 0.2) {
for (let x = c; x < d; x = x + 0.2) {
console.log(`${i}:${x}`);
let fetching = true;
let current_station_data: stationdata[] = [];
Expand Down

0 comments on commit 688a172

Please sign in to comment.