Skip to content

Commit

Permalink
extract file urls to a new method (#331)
Browse files Browse the repository at this point in the history
  • Loading branch information
mrbusche authored Oct 7, 2023
1 parent 8cd299b commit 674f78c
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions src/main/java/trap/report/DownloadHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,7 @@ public void downloadFiles(String[] trapTypes) throws IOException, URISyntaxExcep
long start = System.currentTimeMillis();
System.out.println("Started downloading files");

Map<String, String> fileUrls = new HashMap<>();
fileUrls.put("singles", "https://metabase.sssfonline.com/public/question/8648faf9-42e8-4a9c-b55d-2f251349de7f.csv");
fileUrls.put("doubles", "https://metabase.sssfonline.com/public/question/5d5a78a5-2356-477f-b1b8-fe6ee11d25b1.csv");
fileUrls.put("handicap", "https://metabase.sssfonline.com/public/question/69ca55d9-3e18-45bc-b57f-73aeb205ece8.csv");
fileUrls.put("skeet", "https://metabase.sssfonline.com/public/question/c697d744-0e06-4c3f-a640-fea02f9c9ecd.csv");
fileUrls.put("clays", "https://metabase.sssfonline.com/public/question/2c6edb1a-a7ee-43c2-8180-ad199a57be55.csv");
fileUrls.put("fivestand", "https://metabase.sssfonline.com/public/question/3c5aecf2-a9f2-49b2-a11f-36965cb1a964.csv");
fileUrls.put("doublesskeet", "https://metabase.sssfonline.com/public/question/bdd61066-6e29-4242-b6e9-adf286c2c4ae.csv");
Map<String, String> fileUrls = getFileUrls();

Charset charset = StandardCharsets.UTF_8;
for (String type : trapTypes) {
Expand All @@ -44,4 +37,16 @@ public void downloadFiles(String[] trapTypes) throws IOException, URISyntaxExcep
}
System.out.println("Files downloaded in " + (System.currentTimeMillis() - start) + " ms");
}

private static Map<String, String> getFileUrls() {
Map<String, String> fileUrls = new HashMap<>();
fileUrls.put("singles", "https://metabase.sssfonline.com/public/question/8648faf9-42e8-4a9c-b55d-2f251349de7f.csv");
fileUrls.put("doubles", "https://metabase.sssfonline.com/public/question/5d5a78a5-2356-477f-b1b8-fe6ee11d25b1.csv");
fileUrls.put("handicap", "https://metabase.sssfonline.com/public/question/69ca55d9-3e18-45bc-b57f-73aeb205ece8.csv");
fileUrls.put("skeet", "https://metabase.sssfonline.com/public/question/c697d744-0e06-4c3f-a640-fea02f9c9ecd.csv");
fileUrls.put("clays", "https://metabase.sssfonline.com/public/question/2c6edb1a-a7ee-43c2-8180-ad199a57be55.csv");
fileUrls.put("fivestand", "https://metabase.sssfonline.com/public/question/3c5aecf2-a9f2-49b2-a11f-36965cb1a964.csv");
fileUrls.put("doublesskeet", "https://metabase.sssfonline.com/public/question/bdd61066-6e29-4242-b6e9-adf286c2c4ae.csv");
return fileUrls;
}
}

0 comments on commit 674f78c

Please sign in to comment.