From 464d7f34c1a4442dbe262c75fd28107b0d8cb2fe Mon Sep 17 00:00:00 2001 From: Gwenhael Le Moine Date: Sat, 13 Aug 2016 19:07:10 +0200 Subject: [PATCH 1/6] rake pry --- tasks/pry.rake | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/tasks/pry.rake b/tasks/pry.rake index 55a69d0a..7ca725fb 100644 --- a/tasks/pry.rake +++ b/tasks/pry.rake @@ -1,20 +1,17 @@ # coding: utf-8 ENV['RACK_ENV'] = 'development' -namespace :pry do - task :load_config do - require 'rubygems' - require 'bundler' +task :load_config do + require 'rubygems' + require 'bundler' - Bundler.require( :default, ENV['RACK_ENV'].to_sym ) # require tout les gems définis dans Gemfile - - require_relative '../lib/ledger' - require_relative '../config/options' - end - - desc 'Open pry with DB environment setup' - task pry: :load_config do - pry.binding - end + Bundler.require( :default, ENV['RACK_ENV'].to_sym ) # require tout les gems définis dans Gemfile + require_relative '../lib/ledger' + require_relative '../config/options' +end + +desc 'Open pry with DB environment setup' +task pry: :load_config do + pry.binding end From d9b4d922ccd8c960ca58f1188ed4cf78c22ee362 Mon Sep 17 00:00:00 2001 From: Gwenhael Le Moine Date: Sun, 23 Oct 2016 10:34:54 +0200 Subject: [PATCH 2/6] bundle update --- Gemfile.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index bf9cb8ec..47dde8c1 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -12,7 +12,7 @@ GEM rack-protection (1.5.3) rack rack-rewrite (1.5.1) - rake (11.2.2) + rake (11.3.0) sinatra (1.4.7) rack (~> 1.5) rack-protection (~> 1.4) @@ -34,4 +34,4 @@ DEPENDENCIES sinatra-param BUNDLED WITH - 1.12.5 + 1.13.6 From 5abdf3eabfa70dc6efa0fc206ce9d72d46bf756c Mon Sep 17 00:00:00 2001 From: Gwenhael Le Moine Date: Sun, 23 Oct 2016 10:35:12 +0200 Subject: [PATCH 3/6] wip --- lib/ledger.rb | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/lib/ledger.rb b/lib/ledger.rb index f4326aee..325f8a2b 100644 --- a/lib/ledger.rb +++ b/lib/ledger.rb @@ -63,6 +63,7 @@ module Ledger period = period.nil? ? '' : "-p '#{period}'" depth = depth.nil? ? '' : "--depth #{depth}" operation = cleared ? 'cleared' : 'balance' + run( "--flat --no-total --exchange '#{CURRENCY}' #{period} #{depth}", operation, categories ) .split( "\n" ) .map do |line| @@ -72,7 +73,20 @@ module Ledger amount: line_array[ 0 ].tr( SEPARATOR, '.' ).to_f } end end - + + # def int_treefied_balance( node ) + # return { name: node[:account], size: node[:amount] } unless node[:account].include( ':' ) + + # { name: node[:account].split(':').first, + # children: int_treefied_balance( ... ) } + # end + + # def treefeid_balance( cleared = false, depth = nil, period = nil, categories = '' ) + # bal = balance( cleared, depth, period, categories ) + + + # end + def cleared run( "--flat --no-total --exchange '#{CURRENCY}'", 'cleared', 'Assets Equity' ) .split( "\n" ) From af911d67f8a28a3b510d8baececde7950c7f9fc5 Mon Sep 17 00:00:00 2001 From: Gwenhael Le Moine Date: Sun, 23 Oct 2016 10:36:24 +0200 Subject: [PATCH 4/6] hide tables --- public/app/js/controllers/DashboardCtrl.js | 96 ++++++++++++---------- public/app/js/templates/dashboard.html | 54 ++++++------ 2 files changed, 80 insertions(+), 70 deletions(-) diff --git a/public/app/js/controllers/DashboardCtrl.js b/public/app/js/controllers/DashboardCtrl.js index 4b5a8f29..309bc772 100644 --- a/public/app/js/controllers/DashboardCtrl.js +++ b/public/app/js/controllers/DashboardCtrl.js @@ -119,14 +119,19 @@ app.controller( 'DashboardCtrl', }; this.pie_graph_options = { chart: { type: 'pieChart', + donut: true, + donutRatio: 0.25, height: 300, x: function( d ) { return d.account; }, y: function( d ) { return d.amount; }, showLabels: false, - showLegend: false, + showLegend: true, + legendPosition: 'right', + showTooltipPercent: true, duration: 500, labelThreshold: 0.01, - labelSunbeamLayout: true + labelSunbeamLayout: true, + donutLabelsOutside: true } }; }; @@ -202,48 +207,53 @@ app.controller( 'DashboardCtrl', } ); } ); - $scope.graphiques = { monthly_values: { options: { chart: { type: 'multiBarChart', - height: 300, - showControls: false, - showLegend: true, - showLabels: true, - stacked: false, - duration: 500, - reduceXTicks: false, - rotateLabels: 67, - labelSunbeamLayout: true, - useInteractiveGuideline: false, - multibar: { - dispatch: { - elementClick: function( event ) { - $scope.period = event.data.x; - retrieve_period_detailed_data(); - } - } - }} - }, - data: _.chain( response.data ) - .keys() - .reverse() - .map( function( key ) { - var multiplicator = ( key == "Income" ) ? -1 : 1; - return { key: key, - values: _.chain(response.data[ key ]).map( function( value ) { - var date = new Date( value.date ); - var period = date.getFullYear() + '-' + ( date.getMonth() < 9 ? '0' : '' ) + ( date.getMonth() + 1 ); - $scope.periods.push( period ); + $scope.graphiques = { + monthly_values: { + options: { + chart: { + type: 'multiBarChart', + height: 300, + showControls: false, + showLegend: true, + showLabels: true, + stacked: false, + duration: 500, + reduceXTicks: false, + rotateLabels: 67, + labelSunbeamLayout: true, + useInteractiveGuideline: false, + multibar: { + dispatch: { + elementClick: function( event ) { + $scope.period = event.data.x; + retrieve_period_detailed_data(); + } + } + } + } + }, + data: _.chain( response.data ) + .keys() + .reverse() + .map( function( key ) { + var multiplicator = ( key == "Income" ) ? -1 : 1; + return { key: key, + values: _.chain(response.data[ key ]).map( function( value ) { + var date = new Date( value.date ); + var period = date.getFullYear() + '-' + ( date.getMonth() < 9 ? '0' : '' ) + ( date.getMonth() + 1 ); + $scope.periods.push( period ); - return { key: key, - x: period, - y: parseInt( value.amount ) * multiplicator }; - } ) - .sortBy( function( item ) { return item.x; } ) - .value() - }; - } ) - .value() - } - }; + return { key: key, + x: period, + y: parseInt( value.amount ) * multiplicator }; + } ) + .sortBy( function( item ) { return item.x; } ) + .value() + }; + } ) + .value() + } + }; $scope.periods = _.chain($scope.periods).uniq().sort().reverse().value(); $scope.period = _($scope.periods).first(); diff --git a/public/app/js/templates/dashboard.html b/public/app/js/templates/dashboard.html index 597822c3..6c937172 100644 --- a/public/app/js/templates/dashboard.html +++ b/public/app/js/templates/dashboard.html @@ -25,37 +25,37 @@ - + - - - - - - - - - - - - - - - - -
accountamountscore
- {{account.account}} - - {{account.amount | number:2}} € - - {{account.score}} -
-
+
From d3e2e45c0c3c9d93e4bf874a25368241f757d7c7 Mon Sep 17 00:00:00 2001 From: Gwenhael Le Moine Date: Sat, 21 Oct 2017 22:48:22 +0200 Subject: [PATCH 5/6] ignore vendor/ --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 74a38e1e..c23999f9 100644 --- a/.gitignore +++ b/.gitignore @@ -34,3 +34,4 @@ .rvmrc /thin.* /bundle/ +vendor/ From 5c7c4752f56f6a616de00a7505223cd8f22361e5 Mon Sep 17 00:00:00 2001 From: Gwenhael Le Moine Date: Sat, 21 Oct 2017 22:48:34 +0200 Subject: [PATCH 6/6] fix select height --- public/app/js/templates/dashboard.html | 28 +++++++++++++------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/public/app/js/templates/dashboard.html b/public/app/js/templates/dashboard.html index 6c937172..b73daf89 100644 --- a/public/app/js/templates/dashboard.html +++ b/public/app/js/templates/dashboard.html @@ -1,9 +1,9 @@ - +

{{period | amDateFormat:'MMMM YYYY'}}

+ ng:repeat="bucket in balance.buckets"> - {{account.account}} = {{account.amount | number:2}} € + {{account.account}} = {{account.amount | number:2}} € - @@ -34,14 +34,14 @@ - - - + + + -
accountamountscoreaccountamountscore
{{account.account}}