Add invitation stats
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing

Show some stats about unused invitations and active inviters
This commit is contained in:
Basti 2021-02-01 22:34:52 +01:00
parent dc7cf107c2
commit 0110f27ada
Signed by untrusted user: basti
GPG Key ID: 9F88009D31D99C72
3 changed files with 13 additions and 9 deletions

View File

@ -119,12 +119,7 @@ main {
} }
section { section {
padding-bottom: 3rem;
margin-bottom: 3rem; margin-bottom: 3rem;
&:not(:last-of-type) {
border-bottom: 1px dotted #ccc;
}
} }
table { table {

View File

@ -1,6 +1,8 @@
class Admin::InvitationsController < Admin::BaseController class Admin::InvitationsController < Admin::BaseController
def index def index
@current_section = :invitations @current_section = :invitations
@invitations_unused_count = Invitation.unused.count
@users_with_referrals_count = Invitation.used.distinct.count(:user_id)
@invitations_used = Invitation.used.order('used_at desc') @invitations_used = Invitation.used.order('used_at desc')
end end
end end

View File

@ -1,7 +1,14 @@
<section> <section>
<h2>Invitations</h2> <h2>Invitations</h2>
<p>
<% if @invitations_used.any? %> There are currently <strong><%= @invitations_unused_count %>
unused invitations</strong> available to existing users.
<strong><%= @users_with_referrals_count %> users</strong> have successfully
invited new users.
</p>
</section>
<% if @invitations_used.any? %>
<section>
<h3>Accepted (<%= @invitations_used.length %>)</h3> <h3>Accepted (<%= @invitations_used.length %>)</h3>
<table> <table>
<thead> <thead>
@ -21,5 +28,5 @@
<% end %> <% end %>
</tbody> </tbody>
</table> </table>
<% end %> </section>
</section> <% end %>