Skip to content

Swf 17 credit health #17

Merged
merged 26 commits into from May 1, 2019
Merged
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
38a78cf
radial progress indicators and page-based nav
ahm11003 Feb 13, 2019
5d7cb80
Added Balance, Utilization, and AccountNumber Controllers. Added PLis…
Mar 6, 2019
10e6442
PList Functions
ahm11003 Mar 6, 2019
c212e13
Merge pull request #5 from rrk12005/demo-radial-style-progress-indica…
jod13004 Mar 6, 2019
83e5766
Added Utilization score calculation
Mar 28, 2019
3be3eef
Renamed files to more accurately represent them. Changed wellness rad…
Mar 29, 2019
5a821f7
no message
Mar 29, 2019
a2f3c9d
Merge branch 'master' into SWF-17-credit-health
ahm11003 Apr 9, 2019
9303329
- Functions for utilization and account (temporary) metrics.
Apr 11, 2019
3599c77
SWF-17 remove storyboard segue
ahm11003 Apr 11, 2019
2c07f8e
SWF-17 pass our metrics to page hierarchy
ahm11003 Apr 11, 2019
416c2ea
SWF-17 credit utilization improvements
ahm11003 Apr 17, 2019
3e7ddcd
SWE-17 remove unused classes and files
ahm11003 Apr 17, 2019
8e8dec7
SWF-17 fix logical error leading to bad utilization score
ahm11003 Apr 17, 2019
a5c4ac1
SWF-17 remove unused class
ahm11003 Apr 17, 2019
85fd3e2
SWF-17 new class to display trends in credit utilization
ahm11003 Apr 17, 2019
4f67b56
SWF-17 new image assets, implementation for utilization trend
ahm11003 Apr 17, 2019
23fb930
SWF-17 Added basic details for utilization trends
ahm11003 Apr 17, 2019
80acdbf
Merge branch 'master' into SWF-17-credit-health
ahm11003 Apr 17, 2019
ddbc228
SWF-17 More wellness implementation
ahm11003 Apr 23, 2019
4a55d89
SWF-17 more wellness configuration
ahm11003 Apr 23, 2019
d170909
SWF-17 remove unused code
ahm11003 Apr 23, 2019
433ebac
SWF-17 More wellness implementation and improvements
ahm11003 Apr 23, 2019
17dd1df
SWF-17 metric calculations
ahm11003 Apr 23, 2019
a949599
SWF-17 clean up how we receive data for utilization
ahm11003 Apr 23, 2019
f84701b
SWF-17 new image assets, wellness calculation
ahm11003 Apr 24, 2019
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.
+42 −30
Diff settings

Always

Just for now

SWF-17 metric calculations

- modified `Account` object model to contain `lastPayment` value to drive the last payment metric
- modified our account fetch to retrieve this value from the servers
- remove unused `Account` properties
- finished implementation for new wellness metrics
  • Loading branch information...
ahm11003 committed Apr 23, 2019
commit 17dd1df3c31edb6417585059327dc2628fbecdcf
@@ -431,7 +431,7 @@
<label width="1" alignment="center" text="Last Payment" textAlignment="center" id="s3f-G9-0Lf">
<fontDescription key="font" type="boldSystem" pointSize="16"/>
</label>
<button width="1" alignment="center" verticalAlignment="bottom" title="Button" id="enb-nR-7wM">
<button width="1" alignment="center" verticalAlignment="bottom" title="Details" id="enb-nR-7wM">
<connections>
<action selector="showDetails" destination="mId-Ii-HO4" id="4pt-Zo-nOe"/>
</connections>
@@ -465,7 +465,7 @@
<fontDescription key="font" type="boldSystem" pointSize="16"/>
</label>
<imageView width="1" height="93" alignment="center" verticalAlignment="center" contentMode="scaleAspectFit" id="JDC-go-3sn"/>
<button width="1" alignment="left" verticalAlignment="bottom" title="Button" id="JxL-nb-z6E">
<button width="1" alignment="left" verticalAlignment="bottom" title="Details" id="JxL-nb-z6E">
<connections>
<action selector="showDetails" destination="WY4-SK-U7W" id="Hie-sR-PE3"/>
</connections>
@@ -496,12 +496,12 @@
<color key="textColor" red="0.55326947770000001" green="0.94338613010000005" blue="0.18923908389999999" alpha="1" colorSpace="calibratedRGB"/>
<fontDescription key="font" type="system" weight="heavy" pointSize="55"/>
</label>
<label width="0.5" height="1" alignment="right" text="Accounts with Good or better Utilization" textAlignment="center" numberOfLines="5" id="W6T-4E-azA">
<label width="0.5" height="1" alignment="right" text="Accounts with 30% or lower Utilization" textAlignment="center" numberOfLines="5" id="W6T-4E-azA">
<fontDescription key="font" type="system" pointSize="12"/>
</label>
</items>
</group>
<button width="1" alignment="left" verticalAlignment="bottom" title="Button" id="HTc-Qj-xOt">
<button width="1" alignment="left" verticalAlignment="bottom" title="Details" id="HTc-Qj-xOt">
<connections>
<action selector="showDetails" destination="uKU-6b-2xO" id="OWF-LN-TCt"/>
</connections>
@@ -59,8 +59,10 @@ class FetchData {
let minPaymentDue = Double(minPayDueString),
let statementBalString = $0.dictionaryValue["statement_bal"]?.string,
let statementBalance = Double(statementBalString),
let lastPmtString = $0.dictionaryValue["last_payment_amount"]?.string,
let lastPayment = Double(lastPmtString),
let accountName = $0.dictionaryValue["cc_program_name"]?.string {
let inAccount = Account(accountAlias, creditLimit, last4, paymentDueDate, currentBalance, availableCredit, minPaymentDue, statementBalance, accountName)
let inAccount = Account(accountAlias, creditLimit, last4, paymentDueDate, currentBalance, availableCredit, minPaymentDue, statementBalance, accountName, lastPayment)
accountList.append(inAccount)
}
}
@@ -15,17 +15,13 @@ class LastPaymentInterfaceController: WKInterfaceController {

override func awake(withContext context: Any?) {
super.awake(withContext: context)
// Configure interface objects here.
}

override func willActivate() {
// This method is called when watch view controller is about to be visible to user
super.willActivate()
}
guard let data = context as? [Any], data.count == 2, let last = data[0] as? Double, let rate = data[1] as? Int else {
NSLog("Error getting utilization data from wellness.")
return
}

override func didDeactivate() {
// This method is called when watch view controller is no longer visible
super.didDeactivate()
valueLabel.setText(String(format: "$%.2f", last))
descriptionLabel.setText("At this rate*, 0% utilization reached in \(rate) month(s).")
}

@IBAction func showDetails() {
@@ -30,7 +30,7 @@ class UtilizationTrendInterfaceController: WKInterfaceController {
override func didAppear() {
// This method is called when watch view controller is about to be visible to user
super.didAppear()
animate(withDuration: 1.5) {
animate(withDuration: 1.0) {
self.trendImage.setAlpha(1.0)
self.trendLabel.setAlpha(1.0)
}
@@ -14,6 +14,10 @@ class WellnessInterfaceController: WKInterfaceController {
var wellnessScore: Int = 0
var utilizationScore: Int = 0
var previousUtil: Int = 0
var lastpayment = 0.0
var lastPmtMetric = 0
var avgUtilization = 0.0
var healthyCount = 0

@IBOutlet weak var image: WKInterfaceImage!

@@ -35,15 +39,28 @@ class WellnessInterfaceController: WKInterfaceController {
var totalBalance: Double = 0
var totalCredit: Double = 0
var previous: Double = 0
var average = 0.0

accounts.forEach {
totalCredit += $0.creditLimit
totalBalance += $0.curBalance
let util = $0.curBalance / $0.creditLimit
if util <= 0.3 {
healthyCount += 1
}
average += util
previous += Double(arc4random_uniform(UInt32($0.creditLimit)))
}

avgUtilization = average / Double(accounts.count)
utilizationScore = Int((totalBalance / totalCredit) * 100)
previousUtil = Int((previous / totalCredit) * 100)

if accounts.count == 1 {
lastpayment = accounts[0].lastPayment
let rate = Float(accounts[0].curBalance / lastpayment).rounded(.up)
lastPmtMetric = Int(rate)
}
}

private func calculateWellness() {
@@ -54,11 +71,11 @@ class WellnessInterfaceController: WKInterfaceController {
@IBAction func moreButtonTapped() {
if accounts.count > 1 {
let pages = ["UtilizationScore", "UtilizationTrend", "AvgUtilization", "HealthyAccts"]
let contexts: [Any] = [utilizationScore, [utilizationScore, previousUtil], 35.5, 7]
let contexts: [Any] = [utilizationScore, [utilizationScore, previousUtil], avgUtilization, healthyCount]
presentController(withNames: pages, contexts: contexts)
} else {
let pages = ["UtilizationScore", "UtilizationTrend", "LastPayment"]
let contexts: [Any] = [utilizationScore, [utilizationScore, previousUtil], [10.00, 125.00]]
let contexts: [Any] = [utilizationScore, [utilizationScore, previousUtil], [lastpayment, lastPmtMetric]]
presentController(withNames: pages, contexts: contexts)
}
}
@@ -13,26 +13,23 @@ class Account: NSObject {
var last4: String
//var transactions: [Transaction]
var paymentDueDate: Date
//var cycleEndDate: Date
var curBalance: Double
var availCredit: Double
//var balance: Double
var minPayDue: Double
var statementBal: Double
var accountName: String
var lastPayment: Double

init(_ accountAlias: String, _ creditLimit: Double, _ last4: String, _ paymentDueDate: Date, _ curBalance: Double, _ availCredit: Double, _ minPayDue: Double, _ statementBal: Double, _ accountName: String) {
init(_ accountAlias: String, _ creditLimit: Double, _ last4: String, _ paymentDueDate: Date, _ curBalance: Double, _ availCredit: Double, _ minPayDue: Double, _ statementBal: Double, _ accountName: String, _ last: Double) {
self.accountAlias = accountAlias
self.creditLimit = creditLimit
self.last4 = last4
//self.transactions = transactions
//self.balance = transactions.map { $0.amount }.reduce(0.0, +)
self.paymentDueDate = paymentDueDate
//self.cycleEndDate = cycleEndDate
self.curBalance = curBalance
self.minPayDue = minPayDue
self.availCredit = availCredit
self.statementBal = statementBal
self.accountName = accountName
self.lastPayment = last
}
}
@@ -26,7 +26,7 @@ final class Defaults {
static let UTIL = "Credit utilization is the ratio of credit used compared to total credit. Ideally, this value should be 30% or below."
static let UTIL_TRENDS = "Lowering your utilization over time can help reduce the amount of interest accrued on your accounts."
static let AVG_UTIL = "Average Utilization shows the mean credit utilization across all of your CareCredit accounts"
static let LAST_PAYMENT = "Making monthly payments at this rate (excluding interests), you can eliminate your balance in the noted time period."
static let LAST_PAYMENT = "Making monthly payments at this rate (excluding interest), you can eliminate your balance in the noted time period."
static let HEALTHY_ACCTS = "Healthy accounts shows how many of your CareCredit accounts stand with a utilization at 30% or below."

static let careCreditDateFormatter: DateFormatter = {
@@ -47,13 +47,13 @@ final class Defaults {
"mobile_longitude": 0.0],
"password": "Test12test",
"scope": "default",
"username": "hhgregg2088"]
"username": "carecredit"]
}()

// this header is used for multi-account and fetch banks resources
static var headerForMulti: [String: Any] = {
return ["header": defaultHeader,
"username": "hhgregg2088"]
"username": "carecredit"]
}()

static var headerForTransaction: [String: Any] = {
@@ -72,7 +72,7 @@ final class Defaults {
"header": defaultHeader,
"scope_indicator": "B",
"start_date": start_date,
"username": "hhgregg2088"]
"username": "carecredit"]
}()

static var headerForCancelPmt: [String: Any] = {
@@ -90,7 +90,7 @@ final class Defaults {
"scope_indicator": "B",
"payment_confirmation_number": pmt_confirmation,
"payment_id": payment_id,
"username": "hhgregg2088"]
"username": "carecredit"]
}()

static var headerForPmt: [String: Any] = {
@@ -106,6 +106,6 @@ final class Defaults {
"payment_amount": 123.45,
"payment_amount_type": "CBL",
"scheduled_payment_post_date": "20190306",
"username": "hhgregg2088"]
"username": "carecredit"]
}()
}
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.