jzimmek-reportme 0.4.1 → 0.4.2
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.
- data/VERSION +1 -1
 - data/lib/reportme.rb +1 -2
 - data/lib/reportme/report_factory.rb +16 -0
 - metadata +1 -1
 
    
        data/VERSION
    CHANGED
    
    | 
         @@ -1 +1 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            0.4. 
     | 
| 
      
 1 
     | 
    
         
            +
            0.4.2
         
     | 
    
        data/lib/reportme.rb
    CHANGED
    
    
| 
         @@ -289,6 +289,22 @@ module Reportme 
     | 
|
| 
       289 
289 
     | 
    
         
             
                  end
         
     | 
| 
       290 
290 
     | 
    
         | 
| 
       291 
291 
     | 
    
         
             
                end
         
     | 
| 
      
 292 
     | 
    
         
            +
                
         
     | 
| 
      
 293 
     | 
    
         
            +
                def self.reset(report_name, periods=[:day])
         
     | 
| 
      
 294 
     | 
    
         
            +
                  
         
     | 
| 
      
 295 
     | 
    
         
            +
                  report_name = report_name.to_sym
         
     | 
| 
      
 296 
     | 
    
         
            +
                  
         
     | 
| 
      
 297 
     | 
    
         
            +
                  raise "could not reset unknown report '#{report_name}'" unless has_report?(report_name)
         
     | 
| 
      
 298 
     | 
    
         
            +
                  
         
     | 
| 
      
 299 
     | 
    
         
            +
                  report = report_by_name(report_name)
         
     | 
| 
      
 300 
     | 
    
         
            +
                  
         
     | 
| 
      
 301 
     | 
    
         
            +
                  periods.each do |period|
         
     | 
| 
      
 302 
     | 
    
         
            +
                    table_name = report.table_name(period)
         
     | 
| 
      
 303 
     | 
    
         
            +
                    exec("delete from report_informations where report = '#{table_name}';")
         
     | 
| 
      
 304 
     | 
    
         
            +
                    exec("drop table if exists #{table_name};")
         
     | 
| 
      
 305 
     | 
    
         
            +
                  end
         
     | 
| 
      
 306 
     | 
    
         
            +
                  
         
     | 
| 
      
 307 
     | 
    
         
            +
                end
         
     | 
| 
       292 
308 
     | 
    
         | 
| 
       293 
309 
     | 
    
         
             
                def self.__sort_periods(periods)
         
     | 
| 
       294 
310 
     | 
    
         |