worktrack 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/bin/worktrack +1 -0
  2. data/lib/worktrack.rb +7 -6
  3. metadata +2 -2
data/bin/worktrack CHANGED
@@ -1,5 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
  require 'worktrack'
3
+ #require './lib/worktrack.rb'
3
4
 
4
5
  tracker = WorkTrack.new
5
6
  if ARGV[0] == "-show"
data/lib/worktrack.rb CHANGED
@@ -110,7 +110,6 @@ class WorkTrack
110
110
  @work_frames[rep.id] = []
111
111
  }
112
112
  @last_repo=0
113
- @last_time=0
114
113
  @starttime=0
115
114
  @endtime=0
116
115
 
@@ -119,8 +118,6 @@ class WorkTrack
119
118
 
120
119
  @DB.fetch("select * from changes where timestamp > '#{from}' and timestamp < '#{to}' order by repo_id") do |c|
121
120
  if (c[:repo_id] != @last_repo)
122
- @last_repo=c[:repo_id]
123
- @last_time=-1
124
121
  if @starttime > 0
125
122
  @endtime = @starttime + @corridor unless @endtime > 0
126
123
  @rep=Repo.where(:id => @last_repo).first
@@ -128,6 +125,7 @@ class WorkTrack
128
125
  end
129
126
  @endtime=0
130
127
  @starttime=0
128
+ @last_repo=c[:repo_id]
131
129
  end
132
130
  unless @starttime > 0
133
131
  @starttime=c[:timestamp].to_i
@@ -137,12 +135,15 @@ class WorkTrack
137
135
  if c[:timestamp].to_i < (@endtime + @corridor)
138
136
  @endtime=c[:timestamp].to_i + @corridor
139
137
  else
140
- @rep=Repo.where(:id => @last_repo).first
141
- @work_frames[@last_repo] << {:repository => @rep.name, :from => Time.at(@starttime), :to => Time.at(@endtime), :amount => (@endtime - @starttime)/60 }
138
+ @rep=Repo.where(:id => c[:repo_id]).first
139
+ @work_frames[c[:repo_id]] << {:repository => @rep.name, :from => Time.at(@starttime), :to => Time.at(@endtime), :amount => (@endtime - @starttime)/60 }
142
140
  @starttime=c[:timestamp].to_i
143
141
  @endtime=@starttime + @corridor
144
142
  end
145
- @last_time += 1
143
+ end
144
+ if @starttime > 0
145
+ @rep=Repo.where(:id => @last_repo).first
146
+ @work_frames[@last_repo] << {:repository => @rep.name, :from => Time.at(@starttime), :to => Time.at(@endtime), :amount => (@endtime - @starttime)/60 }
146
147
  end
147
148
 
148
149
  prettyprint(@work_frames)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: worktrack
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-02-19 00:00:00.000000000 Z
12
+ date: 2013-02-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: listen