Skip to content

Commit

Permalink
also download requests
Browse files Browse the repository at this point in the history
  • Loading branch information
jonasoreland committed Oct 21, 2015
1 parent bd90059 commit bce939d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
5 changes: 4 additions & 1 deletion src/main/java/org/oreland/entity/Activity.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ public Activity copy() {
public enum Type {
GAME,
TRAINING,
CUP;
CUP,
REQUEST;

public static Type parse(String type) {
if (type.matches("GAME"))
Expand All @@ -34,6 +35,8 @@ else if (type.matches("TRAINING"))
return TRAINING;
else if (type.matches("CUP"))
return CUP;
else if (type.matches("REQUEST"))
return REQUEST;
System.out.println("type: " + type + " => NULL");
return null;
}
Expand Down
18 changes: 7 additions & 11 deletions src/main/java/org/oreland/sync/MyClub.java
Original file line number Diff line number Diff line change
Expand Up @@ -377,23 +377,19 @@ public void loadActivities(Repository repo) throws IOException, ParseException {
continue;
String type = columns.get(5).text();
Activity activity = null;
String desc = columns.get(0).text();
String date = columns.get(1).text().substring(0, 8);
String id = columns.get(7).select("a[href]").first().attr("href").replace("/activities/team/view_parts/", "").replace("/", "");
if (type.equals("Match")) {
String desc = columns.get(0).text();
String date = columns.get(1).text().substring(0, 8);
String id = columns.get(7).select("a[href]").first().attr("href").replace("/activities/team/view_parts/", "").replace("/", "");
activity = repo.add(new Activity(id, formatter.parse(date), desc, Activity.Type.GAME));
activity.time = columns.get(3).text().replace('\u00a0', ' ');
} else if (type.matches("Tr.*ning")) {
String desc = columns.get(0).text();
String date = columns.get(1).text().substring(0, 8);
String id = columns.get(7).select("a[href]").first().attr("href").replace("/activities/team/view_parts/", "").replace("/", "");
activity = repo.add(new Activity(id, formatter.parse(date), desc, Activity.Type.TRAINING));
activity.time = columns.get(3).text().replace('\u00a0', ' ');
} else if (type.matches("Cup")) {
String desc = columns.get(0).text();
String date = columns.get(1).text().substring(0, 8);
String id = columns.get(7).select("a[href]").first().attr("href").replace("/activities/team/view_parts/", "").replace("/", "");
activity = repo.add(new Activity(id, formatter.parse(date), desc, Activity.Type.CUP));
} else if (type.matches("F.*rfr.*gan")) {
activity = repo.add(new Activity(id, formatter.parse(date), desc, Activity.Type.REQUEST));
}
if (activity != null) {
activity.time = columns.get(3).text().replace('\u00a0', ' ');
}

Expand Down

0 comments on commit bce939d

Please sign in to comment.