package org.tndata.android.compass.model;

import com.google.gson.annotations.SerializedName;


/**
 * Daily progress model class. Basic for now.
 *
 * @author Ismael Alonso
 * @version 1.0.0
 */
public class DailyProgress extends TDCBase{
    //Types
    public static final String API_TYPE = "dailyprogress";
    public static final String TYPE = "daily_progress";


    @SerializedName("actions_total")
    private int mTotalActions;
    @SerializedName("actions_completed")
    private int mCompletedActions;
    @SerializedName("actions_snoozed")
    private int mSnoozedActions;
    @SerializedName("actions_dismissed")
    private int mDismissedActions;


    public float getCompletedFraction(){
        if (mTotalActions == 0){
            return 0;
        }
        return (float)mCompletedActions/mTotalActions;
    }

    public float getSnoozedFraction(){
        if (mTotalActions == 0){
            return 0;
        }
        return (float)mSnoozedActions/mTotalActions;
    }

    public float getDismissedFraction(){
        if (mTotalActions == 0){
            return 0;
        }
        return (float)mDismissedActions/mTotalActions;
    }

    @Override
    protected String getType(){
        return TYPE;
    }
}

@@ -655,16 +655,357 @@
 tions;%0A%0A
+    @SerializedName(%22customactions_total%22)%0A    private int mTotalCustomActions;%0A    @SerializedName(%22customactions_completed%22)%0A    private int mCompletedCustomActions;%0A    @SerializedName(%22customactions_snoozed%22)%0A    private int mSnoozedCustomActions;%0A    @SerializedName(%22customactions_dismissed%22)%0A    private int mDismissedCustomActions;%0A%0A
 %0A    pub
@@ -1039,35 +1039,43 @@
 ion()%7B%0A        i
-f (
+nt total = 
 mTotalActions ==
@@ -1064,32 +1064,73 @@
 = mTotalActions 
++ mTotalCustomActions;%0A        if (total 
 == 0)%7B%0A         
@@ -1174,16 +1174,17 @@
  (float)
+(
 mComplet
@@ -1188,38 +1188,53 @@
 letedActions
-/mTotalActions
++mSnoozedCustomActions)/total
 ;%0A    %7D%0A%0A   
@@ -1270,35 +1270,43 @@
 ion()%7B%0A        i
-f (
+nt total = 
 mTotalActions ==
@@ -1295,32 +1295,73 @@
 = mTotalActions 
++ mTotalCustomActions;%0A        if (total 
 == 0)%7B%0A         
@@ -1405,16 +1405,17 @@
  (float)
+(
 mSnoozed
@@ -1417,38 +1417,53 @@
 oozedActions
-/mTotalActions
++mSnoozedCustomActions)/total
 ;%0A    %7D%0A%0A   
@@ -1509,19 +1509,27 @@
        i
-f (
+nt total = 
 mTotalAc
@@ -1534,16 +1534,57 @@
 Actions 
++ mTotalCustomActions;%0A        if (total 
 == 0)%7B%0A 
@@ -1636,16 +1636,17 @@
  (float)
+(
 mDismiss
@@ -1658,22 +1658,39 @@
 ions
-/mTotalActions
++mDismissedCustomActions)/total
 ;%0A  

Complete DailyProgress