Add invitation stats
Show some stats about unused invitations and active inviters
This commit is contained in:
		
							parent
							
								
									dc7cf107c2
								
							
						
					
					
						commit
						0110f27ada
					
				| @ -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 { | ||||||
|  | |||||||
| @ -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 | ||||||
|  | |||||||
| @ -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 %> | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user