forked from bimovidia/planning-poker
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* show all activities * Fix user recording. * Infer meetings. * Added tests for session inference. * Fixed rspec tests. * Updated UI. * Updated UI and added some basic numbers for a meeting.
- Loading branch information
1 parent
64fdea3
commit 4c764c1
Showing
18 changed files
with
212 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
2.2.2 | ||
2.3.8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,22 @@ | ||
module ActivitiesHelper | ||
def meeting_start(meetings) | ||
meetings.first.created_at | ||
end | ||
|
||
def meeting_length(meetings) | ||
((meetings.last.created_at - meetings.first.created_at) / 60.0).round(2) | ||
end | ||
|
||
def num_stories_updated(meetings) | ||
meetings.select { |act| act.activity_type.eql? 'dashboard#update' } | ||
.map(&:story_id).uniq.length | ||
end | ||
|
||
def num_votes(meetings) | ||
meetings.select { |act| act.activity_type.eql? 'dashboard#vote' }.length | ||
end | ||
|
||
def num_participants(meetings) | ||
meetings.map(&:username).uniq.length | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,20 @@ | ||
class Activity < ActiveRecord::Base | ||
belongs_to :user | ||
belongs_to :vote, required: false | ||
|
||
def self.infer_meetings | ||
prev_time = Activity.first.created_at | ||
meetings = [] | ||
current_meeting = [] | ||
Activity.all.each do |activity| | ||
if (activity.created_at - prev_time) > 60 * 60 | ||
meetings.push(current_meeting.clone) | ||
current_meeting = [activity] | ||
else | ||
current_meeting.push(activity) | ||
end | ||
prev_time = activity.created_at | ||
end | ||
meetings.push(current_meeting.clone) | ||
meetings | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<table> | ||
<thead> | ||
<tr> | ||
<th>Project ID</th> | ||
<th>Story ID</th> | ||
<th>User</th> | ||
<th>Activity Type</th> | ||
<th>Activity Data</th> | ||
<th>Timestamp</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<%- @activities.each do |activity| %> | ||
<tr> | ||
<td><%= activity.project_id %></td> | ||
<td><%= activity.story_id %></td> | ||
<td><%= activity.username %></td> | ||
<td><%= activity.activity_type %></td> | ||
<td><%= activity.activity_data %></td> | ||
<td><%= activity.created_at %></td> | ||
</tr> | ||
<% end %> | ||
</tbody> | ||
</table> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
<head> | ||
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous"> | ||
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script> | ||
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script> | ||
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script> | ||
</head> | ||
|
||
<table class="table"> | ||
<thead> | ||
<tr> | ||
<th>Meeting Number</th> | ||
<th>Started At</th> | ||
<th>Length of the meeting</th> | ||
<th>Participants</th> | ||
<th>Story updated</th> | ||
<th>Votes</th> | ||
<th>See more</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<%- @meetings.each_with_index do |meeting, ind| %> | ||
<tr> | ||
<td> | ||
Meeting <%= ind %> | ||
</td> | ||
<td> | ||
<%= meeting_start(meeting) %> | ||
</td> | ||
<td> | ||
<%= meeting_length(meeting) %> minutes | ||
</td> | ||
<td> | ||
<%= num_participants(meeting) %> participants | ||
</td> | ||
<td> | ||
<%= num_stories_updated(meeting) %> stories updated | ||
</td> | ||
<td> | ||
<%= num_votes(meeting) %> votes | ||
</td> | ||
<td> | ||
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#meeting-<%= ind %>"> | ||
Activities | ||
</button> | ||
</td> | ||
</tr> | ||
<% end %> | ||
</tbody> | ||
|
||
</table> | ||
|
||
<%- @meetings.each_with_index do |meeting, ind| %> | ||
<!-- Modal --> | ||
<div class="modal fade" id="meeting-<%= ind %>" tabindex="-1" role="dialog" aria-labelledby="label_<%= ind %>" aria-hidden="true"> | ||
<div class="modal-dialog modal-lg" role="document"> | ||
<div class="modal-content"> | ||
<div class="modal-header"> | ||
<h5 class="modal-title" id="label_<%= ind %>">Modal title</h5> | ||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"> | ||
<span aria-hidden="true">×</span> | ||
</button> | ||
</div> | ||
<div class="modal-body"> | ||
<table> | ||
<thead> | ||
<tr> | ||
<th>Project ID</th> | ||
<th>Story ID</th> | ||
<th>User</th> | ||
<th>Activity Type</th> | ||
<th>Timestamp</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<%- meeting.each do |activity| %> | ||
<tr> | ||
<td><%= activity.project_id %></td> | ||
<td><%= activity.story_id %></td> | ||
<td><%= activity.username %></td> | ||
<td><%= activity.activity_type %></td> | ||
<td><%= activity.created_at %></td> | ||
</tr> | ||
<% end %> | ||
</tbody> | ||
</table> | ||
</div> | ||
<div class="modal-footer"> | ||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
<% end %> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
class AddUsernameToActivity < ActiveRecord::Migration | ||
def change | ||
add_column :activities, :username, :string | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,4 +13,7 @@ | |
vote { Forgery::Basic.number(at_least: 1, at_most: 5) } | ||
end | ||
|
||
factory :activity do | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,25 @@ | ||
require 'rails_helper' | ||
require 'spec_helper' | ||
|
||
RSpec.describe Activity, type: :model do | ||
|
||
describe 'self.infer_meetings' do | ||
before :each do | ||
t = Time.now | ||
FactoryBot.create(:activity, created_at: t) | ||
FactoryBot.create(:activity, created_at: t+1.minute) | ||
FactoryBot.create(:activity, created_at: t+1.hour+2.minute) | ||
FactoryBot.create(:activity, created_at: t+1.day) | ||
FactoryBot.create(:activity, created_at: t+1.day+1.minute) | ||
end | ||
it 'groups activities together' do | ||
expect(Activity.infer_meetings.length).to eql(3) | ||
end | ||
|
||
it 'divides activities correctly' do | ||
meetings = Activity.infer_meetings | ||
expect(meetings[0].length).to eql(2) | ||
expect(meetings[1].length).to eql(1) | ||
expect(meetings[2].length).to eql(2) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters