Merge branch 'feature/daily-avg' into 'develop'

Add a daily post average to the user card

See merge request !63
This commit is contained in:
Shpuld Shpuldson 2017-03-11 06:48:17 -05:00
commit d427eaca90

View File

@ -40,7 +40,7 @@
<div class="user-counts"> <div class="user-counts">
<div class="user-count"> <div class="user-count">
<h5>Statuses</h5> <h5>Statuses</h5>
<span>{{user.statuses_count}}</span> <span>{{user.statuses_count}} <br><span class="dailyAvg">{{dailyAvg}} per day</span></span>
</div> </div>
<div class="user-count"> <div class="user-count">
<h5>Following</h5> <h5>Following</h5>
@ -77,6 +77,11 @@
}, },
loggedIn () { loggedIn () {
return this.$store.state.users.currentUser return this.$store.state.users.currentUser
},
dailyAvg () {
return Math.round(
this.user.statuses_count / ((new Date() - new Date(this.user.created_at)) / (60 * 60 * 24 * 1000))
)
} }
}, },
methods: { methods: {
@ -217,4 +222,9 @@
margin: 0 0 0.25em; margin: 0 0 0.25em;
} }
} }
.dailyAvg {
font-size: 0.8em;
opacity: 0.5;
}
</style> </style>