time-sheet 0.10.0 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
 - data/lib/time_sheet/time/cmd.rb +1 -0
 - data/lib/time_sheet/time/entry.rb +18 -2
 - data/lib/time_sheet/version.rb +1 -1
 - metadata +2 -2
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: c1f3f57a31269c965756a1eb5f00eccd8c831ab69bcd2f71cc65ca9242e54dcc
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: b5e121a0c379450019c7606ee994c5ea5ebdb5e5cef8afcb3f33f5fe864b8a6f
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: c31004116f099381d80021a34d04c541bc13b221e0d980c9f073f28150dd8843fb837022670ff46015ddc1dd62c9d294d9847b9e4d5207d45249ca8ebf720389
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: a7f08110118e2aaacb4569e6d3835b4c40660a0561318490edef9b0023a6c33061bc2ff3c068062ce7d9bfb382926aaae44448e36715ab68988dc6b4d7aeb270
         
     | 
    
        data/lib/time_sheet/time/cmd.rb
    CHANGED
    
    | 
         @@ -117,6 +117,7 @@ class TimeSheet::Time::Cmd 
     | 
|
| 
       117 
117 
     | 
    
         
             
                  o.string '-t', '--to', 'ignore entries more recent than the date given'
         
     | 
| 
       118 
118 
     | 
    
         
             
                  o.string '-p', '--project', 'take only entries of this project into account'
         
     | 
| 
       119 
119 
     | 
    
         
             
                  o.string '-a', '--activity', 'take only entries of this activity into account'
         
     | 
| 
      
 120 
     | 
    
         
            +
                  o.string '--tags', 'take only entries with these tags into account (comma separated, not case sensitive)'
         
     | 
| 
       120 
121 
     | 
    
         
             
                  o.string '-d', '--description', 'consider only entries matching this description'
         
     | 
| 
       121 
122 
     | 
    
         
             
                  o.string '-e', '--employee', 'consider only entries for this employee'
         
     | 
| 
       122 
123 
     | 
    
         
             
                  o.float '-r', '--rate', 'use an alternative hourly rate (default: 80.0)', default: 80.00
         
     | 
| 
         @@ -78,7 +78,8 @@ class TimeSheet::Time::Entry 
     | 
|
| 
       78 
78 
     | 
    
         
             
              end
         
     | 
| 
       79 
79 
     | 
    
         | 
| 
       80 
80 
     | 
    
         
             
              def tags
         
     | 
| 
       81 
     | 
    
         
            -
                 
     | 
| 
      
 81 
     | 
    
         
            +
                binding.pry if @data['tags'] == 86
         
     | 
| 
      
 82 
     | 
    
         
            +
                self.class.parse_tags(@data['tags'])
         
     | 
| 
       82 
83 
     | 
    
         
             
              end
         
     | 
| 
       83 
84 
     | 
    
         | 
| 
       84 
85 
     | 
    
         
             
              def working_day?
         
     | 
| 
         @@ -90,7 +91,9 @@ class TimeSheet::Time::Entry 
     | 
|
| 
       90 
91 
     | 
    
         
             
                from = from.to_time if from.is_a?(Date)
         
     | 
| 
       91 
92 
     | 
    
         
             
                to = (filters[:to] ? filters[:to] : nil)
         
     | 
| 
       92 
93 
     | 
    
         
             
                to = (to + 1).to_time if to.is_a?(Date)
         
     | 
| 
      
 94 
     | 
    
         
            +
                tags = self.class.parse_tags(filters[:tags])
         
     | 
| 
       93 
95 
     | 
    
         | 
| 
      
 96 
     | 
    
         
            +
                has_tags?(tags) &&
         
     | 
| 
       94 
97 
     | 
    
         
             
                self.class.attrib_matches_any?(employee, filters[:employee]) &&
         
     | 
| 
       95 
98 
     | 
    
         
             
                self.class.attrib_matches_any?(description, filters[:description]) &&
         
     | 
| 
       96 
99 
     | 
    
         
             
                self.class.attrib_matches_any?(project, filters[:project]) &&
         
     | 
| 
         @@ -99,6 +102,14 @@ class TimeSheet::Time::Entry 
     | 
|
| 
       99 
102 
     | 
    
         
             
                (!to || to >= self.end)
         
     | 
| 
       100 
103 
     | 
    
         
             
              end
         
     | 
| 
       101 
104 
     | 
    
         | 
| 
      
 105 
     | 
    
         
            +
              def has_tags?(tags)
         
     | 
| 
      
 106 
     | 
    
         
            +
                return true if tags.empty?
         
     | 
| 
      
 107 
     | 
    
         
            +
             
     | 
| 
      
 108 
     | 
    
         
            +
                tags.all? do |tag|
         
     | 
| 
      
 109 
     | 
    
         
            +
                  self.tags.include?(tag)
         
     | 
| 
      
 110 
     | 
    
         
            +
                end
         
     | 
| 
      
 111 
     | 
    
         
            +
              end
         
     | 
| 
      
 112 
     | 
    
         
            +
             
     | 
| 
       102 
113 
     | 
    
         
             
              def valid?
         
     | 
| 
       103 
114 
     | 
    
         
             
                valid!
         
     | 
| 
       104 
115 
     | 
    
         
             
                true
         
     | 
| 
         @@ -157,7 +168,8 @@ class TimeSheet::Time::Entry 
     | 
|
| 
       157 
168 
     | 
    
         
             
                  'duration' => duration,
         
     | 
| 
       158 
169 
     | 
    
         
             
                  'project' => project,
         
     | 
| 
       159 
170 
     | 
    
         
             
                  'activity' => activity,
         
     | 
| 
       160 
     | 
    
         
            -
                  'description' => description
         
     | 
| 
      
 171 
     | 
    
         
            +
                  'description' => description,
         
     | 
| 
      
 172 
     | 
    
         
            +
                  'tags' => tags
         
     | 
| 
       161 
173 
     | 
    
         
             
                }
         
     | 
| 
       162 
174 
     | 
    
         
             
              end
         
     | 
| 
       163 
175 
     | 
    
         | 
| 
         @@ -173,4 +185,8 @@ class TimeSheet::Time::Entry 
     | 
|
| 
       173 
185 
     | 
    
         
             
                end
         
     | 
| 
       174 
186 
     | 
    
         
             
              end
         
     | 
| 
       175 
187 
     | 
    
         | 
| 
      
 188 
     | 
    
         
            +
              def self.parse_tags(string)
         
     | 
| 
      
 189 
     | 
    
         
            +
                (string || '').to_s.downcase.split(/\s*,\s*/).map{|t| t.strip}
         
     | 
| 
      
 190 
     | 
    
         
            +
              end
         
     | 
| 
      
 191 
     | 
    
         
            +
             
     | 
| 
       176 
192 
     | 
    
         
             
            end
         
     | 
    
        data/lib/time_sheet/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: time-sheet
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.11.0
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Moritz Schepp
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire:
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: exe
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2021- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2021-06-25 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: spreadsheet
         
     |