From e749c8a281d303b48282317aebdbf0058fcb59cd Mon Sep 17 00:00:00 2001 From: ligi Date: Sun, 24 Aug 2014 13:48:12 +0200 Subject: [PATCH] nicer label for SWISS --- .../model/ApplePassbookQuirkCorrector.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/main/java/org/ligi/passandroid/model/ApplePassbookQuirkCorrector.java b/src/main/java/org/ligi/passandroid/model/ApplePassbookQuirkCorrector.java index 249d2d14..d99960e0 100644 --- a/src/main/java/org/ligi/passandroid/model/ApplePassbookQuirkCorrector.java +++ b/src/main/java/org/ligi/passandroid/model/ApplePassbookQuirkCorrector.java @@ -14,6 +14,23 @@ public class ApplePassbookQuirkCorrector { careForUSAirways(pass); careForVirginAustralia(pass); careForCathayPacific(pass); + careForSWISS(pass); + } + + private static void careForSWISS(PassImpl pass) { + if (!pass.getOrganisation().isPresent() || !pass.getOrganisation().get().equals("SWISS")) { + return; + } + Tracker.get().trackEvent("quirk_fix", "description_replace", "SWISS", 0L); + + final Optional optionalDepart = pass.getPrimaryFields().getPassFieldForKey("depart"); + final Optional optionalArrive = pass.getPrimaryFields().getPassFieldForKey("destination"); + + if (optionalDepart.isPresent() && optionalArrive.isPresent()) { + Tracker.get().trackEvent("quirk_fix", "description_replace", "SWISS", 1L); + pass.setDescription(optionalDepart.get().value + " -> " + optionalArrive.get().value); + } + }