Added answer stats

This commit is contained in:
M66B
2021-05-13 17:25:34 +02:00
parent 0563c8808b
commit 044f62bd6a
8 changed files with 2574 additions and 14 deletions

View File

@@ -59,6 +59,9 @@ public class EntityAnswer implements Serializable {
public Boolean hide;
@NonNull
public String text;
@NonNull
public Integer applied = 0;
public Long last_applied;
String getText(Address[] address) {
return replacePlaceholders(text, address);
@@ -128,6 +131,8 @@ public class EntityAnswer implements Serializable {
json.put("favorite", favorite);
json.put("hide", hide);
json.put("text", text);
json.put("applied", applied);
json.put("last_applied", last_applied);
return json;
}
@@ -141,6 +146,9 @@ public class EntityAnswer implements Serializable {
answer.favorite = json.optBoolean("favorite");
answer.hide = json.optBoolean("hide");
answer.text = json.getString("text");
answer.applied = json.optInt("applied", 0);
if (json.has("last_applied") && !json.isNull("last_applied"))
answer.last_applied = json.getLong("last_applied");
return answer;
}
@@ -154,8 +162,9 @@ public class EntityAnswer implements Serializable {
this.receipt.equals(other.receipt) &&
this.favorite.equals(other.favorite) &&
this.hide.equals(other.hide) &&
this.text.equals(other.text)
);
this.text.equals(other.text) &&
this.applied.equals(other.applied) &&
Objects.equals(this.last_applied, other.last_applied));
}
return false;
}