Ver Fonte

feat: showing % of fields filled in by account

Kristian Vos há 4 anos atrás
pai
commit
cf513c3c84
1 ficheiros alterados com 6 adições e 0 exclusões
  1. 6 0
      frontend/vue/pages/Accounts.vue

+ 6 - 0
frontend/vue/pages/Accounts.vue

@@ -51,6 +51,10 @@ export default {
 					name: "email",
 					displayName: "Email(s)"
 				},
+				{
+					name: "complete",
+					displayName: "% complete"
+				},
 				{
 					name: "actions-slot",
 					displayName: "Actions"
@@ -67,10 +71,12 @@ export default {
 	computed: {
 		localData: function() {
 			return this.accounts.map(account => {
+				const completePercentage = (Object.keys(account.fields).filter(fieldName => account.fields[fieldName].length >= 1).length / Object.keys(account.fields).length) * 100;
 				return {
 					name: account.fields.name[0].name,
 					domain: account.fields.domain.map(domain => domain.domain).join(", "),
 					email: account.fields.email.map(email => email.email).join(", "),
+					complete: `${(completePercentage % 1 > 0) ? completePercentage.toFixed(2) : completePercentage}%`,
 					accountId: account._id
 				};
 			});