mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-01-23 23:13:18 -06:00
Some new code + GA
This commit is contained in:
parent
f8a5fb4225
commit
e11e53913a
@ -14,3 +14,4 @@ SESSION_DRIVER=file
|
||||
EMAIL_SMTP=
|
||||
EMAIL_USERNAME=
|
||||
EMAIL_PASSWORD=
|
||||
ANALYTICS_ID=
|
@ -5,7 +5,8 @@ Firefly III (v3.3.5)
|
||||
[![Project Status](http://stillmaintained.com/JC5/firefly-iii.png?a=b)](http://stillmaintained.com/JC5/firefly-iii)
|
||||
[![SensioLabsInsight](https://insight.sensiolabs.com/projects/d44c7012-5f50-41ad-add8-8445330e4102/mini.png)](https://insight.sensiolabs.com/projects/d44c7012-5f50-41ad-add8-8445330e4102)
|
||||
[![Code Climate](https://codeclimate.com/github/JC5/firefly-iii/badges/gpa.svg)](https://codeclimate.com/github/JC5/firefly-iii)
|
||||
[![Test Coverage](https://codeclimate.com/github/JC5/firefly-iii/badges/coverage.svg)](https://codeclimate.com/github/JC5/firefly-iii)
|
||||
[![Coverage Status](https://coveralls.io/repos/JC5/firefly-iii/badge.svg?branch=master)](https://coveralls.io/r/JC5/firefly-iii?branch=master)
|
||||
[![Coverage Status](https://coveralls.io/repos/JC5/firefly-iii/badge.svg?branch=master)](https://coveralls.io/r/JC5/firefly-iii?branch=develop)
|
||||
|
||||
[![Latest Stable Version](https://poser.pugx.org/grumpydictator/firefly-iii/v/stable.svg)](https://packagist.org/packages/grumpydictator/firefly-iii)
|
||||
[![Total Downloads](https://poser.pugx.org/grumpydictator/firefly-iii/downloads.svg)](https://packagist.org/packages/grumpydictator/firefly-iii)
|
||||
|
@ -13,7 +13,7 @@ use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Collection;
|
||||
use Navigation;
|
||||
use Session;
|
||||
|
||||
use App;
|
||||
|
||||
/**
|
||||
* Class PiggyBanks
|
||||
@ -50,7 +50,7 @@ class PiggyBanks
|
||||
*/
|
||||
public function handle(Request $request, Closure $next)
|
||||
{
|
||||
if ($this->auth->check() && !$request->isXmlHttpRequest()) {
|
||||
if ($this->auth->check() && !$request->isXmlHttpRequest() && App::environment() != 'testing') {
|
||||
// get piggy banks without a repetition:
|
||||
/** @var Collection $set */
|
||||
$set = $this->auth->user()->piggybanks()
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
namespace FireflyIII\Http\Middleware;
|
||||
|
||||
use App;
|
||||
use Carbon\Carbon;
|
||||
use Closure;
|
||||
use Illuminate\Contracts\Auth\Guard;
|
||||
@ -47,14 +48,14 @@ class Range
|
||||
*/
|
||||
public function handle(Request $request, Closure $theNext)
|
||||
{
|
||||
if ($this->auth->check()) {
|
||||
if ($this->auth->check() && App::environment() != 'testing') {
|
||||
|
||||
// ignore preference. set the range to be the current month:
|
||||
if (!Session::has('start') && !Session::has('end')) {
|
||||
|
||||
/** @var \FireflyIII\Models\Preference $viewRange */
|
||||
$viewRange = Preferences::get('viewRange', '1M');
|
||||
$start = Session::has('start') ? Session::get('start') : new Carbon;
|
||||
$start = new Carbon;
|
||||
$start = Navigation::updateStartDate($viewRange->data, $start);
|
||||
$end = Navigation::updateEndDate($viewRange->data, $start);
|
||||
|
||||
@ -62,7 +63,12 @@ class Range
|
||||
Session::put('end', $end);
|
||||
}
|
||||
if (!Session::has('first')) {
|
||||
$journal = $this->auth->user()->transactionjournals()->orderBy('date', 'ASC')->first(['transaction_journals.*']);
|
||||
/**
|
||||
* Get helper thing.
|
||||
*/
|
||||
/** @var \FireflyIII\Repositories\Journal\JournalRepositoryInterface $repository */
|
||||
$repository = App::make('FireflyIII\Repositories\Journal\JournalRepositoryInterface');
|
||||
$journal = $repository->first();
|
||||
if ($journal) {
|
||||
Session::put('first', $journal->date);
|
||||
} else {
|
||||
|
@ -46,7 +46,7 @@ class Reminders
|
||||
*/
|
||||
public function handle(Request $request, Closure $next)
|
||||
{
|
||||
if ($this->auth->check() && !$request->isXmlHttpRequest()) {
|
||||
if ($this->auth->check() && !$request->isXmlHttpRequest() && App::environment() != 'testing') {
|
||||
// do reminders stuff.
|
||||
$piggyBanks = $this->auth->user()->piggyBanks()->where('remind_me', 1)->get();
|
||||
$today = new Carbon;
|
||||
|
@ -133,8 +133,8 @@ class AccountRepository implements AccountRepositoryInterface
|
||||
->where('account_meta.name', 'accountRole')
|
||||
->where('account_meta.data', '"savingAsset"')
|
||||
->get(['accounts.*']);
|
||||
$start = clone Session::get('start');
|
||||
$end = clone Session::get('end');
|
||||
$start = clone Session::get('start', new Carbon);
|
||||
$end = clone Session::get('end', new Carbon);
|
||||
|
||||
$accounts->each(
|
||||
function (Account $account) use ($start, $end) {
|
||||
|
@ -264,4 +264,12 @@ class JournalRepository implements JournalRepositoryInterface
|
||||
return [$from, $to];
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* Get users first transaction journal
|
||||
*
|
||||
* @return TransactionJournal
|
||||
*/
|
||||
public function first()
|
||||
{
|
||||
return Auth::user()->transactionjournals()->orderBy('date', 'ASC')->first(['transaction_journals.*']);
|
||||
}}
|
||||
|
@ -44,4 +44,10 @@ interface JournalRepositoryInterface
|
||||
* @return mixed
|
||||
*/
|
||||
public function update(TransactionJournal $journal, array $data);
|
||||
|
||||
/**
|
||||
* Get users first transaction journal
|
||||
* @return TransactionJournal
|
||||
*/
|
||||
public function first();
|
||||
}
|
||||
|
@ -7,7 +7,6 @@ use FireflyIII\Models\Component;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
/**
|
||||
* @SuppressWarnings(PHPMD.ShortMethodName) // method names are mandated by laravel.
|
||||
* @SuppressWarnings("TooManyMethods") // I'm fine with this
|
||||
@ -427,28 +426,28 @@ class ChangesForV321 extends Migration
|
||||
|
||||
public function moveComponentIdToBudgetId()
|
||||
{
|
||||
\Log::debug('Now in moveComponentIdToBudgetId()');
|
||||
//Log::debug('Now in moveComponentIdToBudgetId()');
|
||||
BudgetLimit::get()->each(
|
||||
function (BudgetLimit $bl) {
|
||||
\Log::debug('Now at budgetLimit #' . $bl->id . ' with component_id: ' . $bl->component_id);
|
||||
Log::debug('Now at budgetLimit #' . $bl->id . ' with component_id: ' . $bl->component_id);
|
||||
$component = Component::find($bl->component_id);
|
||||
if ($component) {
|
||||
\Log::debug('Found component with id #' . $component->id . ' and name ' . $component->name);
|
||||
Log::debug('Found component with id #' . $component->id . ' and name ' . $component->name);
|
||||
$budget = Budget::whereName($component->name)->whereUserId($component->user_id)->first();
|
||||
if ($budget) {
|
||||
\Log::debug('Found a budget with ID #' . $budget->id . ' and name ' . $budget->name);
|
||||
Log::debug('Found a budget with ID #' . $budget->id . ' and name ' . $budget->name);
|
||||
$bl->budget_id = $budget->id;
|
||||
$bl->save();
|
||||
\Log::debug('Connected budgetLimit #' . $bl->id . ' to budget_id' . $budget->id);
|
||||
Log::debug('Connected budgetLimit #' . $bl->id . ' to budget_id' . $budget->id);
|
||||
} else {
|
||||
\Log::debug('Could not find a matching budget with name ' . $component->name);
|
||||
Log::debug('Could not find a matching budget with name ' . $component->name);
|
||||
}
|
||||
} else {
|
||||
\Log::debug('Could not find a component with id ' . $bl->component_id);
|
||||
Log::debug('Could not find a component with id ' . $bl->component_id);
|
||||
}
|
||||
}
|
||||
);
|
||||
\Log::debug('Done with moveComponentIdToBudgetId()');
|
||||
//Log::debug('Done with moveComponentIdToBudgetId()');
|
||||
|
||||
}
|
||||
|
||||
|
@ -121,19 +121,31 @@
|
||||
<script type="text/javascript" src="js/daterangepicker.js"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
var start = "{{Session::get('start')->format('d-m-Y')}}";
|
||||
var end = "{{Session::get('end')->format('d-m-Y')}}";
|
||||
var titleString = "{{Session::get('start')->format('j M Y')}} - {{Session::get('end')->format('j M Y')}}";
|
||||
var start = "{{Session::get('start', new Carbon\Carbon)->format('d-m-Y')}}";
|
||||
var end = "{{Session::get('end', new Carbon\Carbon)->format('d-m-Y')}}";
|
||||
var titleString = "{{Session::get('start', new Carbon\Carbon)->format('j M Y')}} - {{Session::get('end', new Carbon\Carbon)->format('j M Y')}}";
|
||||
var dateRangeURL = "{{route('daterange')}}";
|
||||
var token = "{{csrf_token()}}";
|
||||
var firstDate = moment("{{Session::get('first')->format('Y-m-d')}}");
|
||||
var currentMonthName = "{{$currentMonthName}}";
|
||||
var previousMonthName = "{{$previousMonthName}}";
|
||||
var nextMonthName = "{{$nextMonthName}}";
|
||||
var firstDate = moment("{{Session::get('first', new Carbon\Carbon)->format('Y-m-d')}}");
|
||||
var currentMonthName = "{{isset($currentMonthName) ? $currentMonthName : 'Month'}}";
|
||||
var previousMonthName = "{{isset($previousMonthName) ? $previousMonthName : 'Month'}}";
|
||||
var nextMonthName = "{{isset($nextMonthName) ? $nextMonthName : 'Month'}}";
|
||||
$('#daterange span').text(titleString);
|
||||
</script>
|
||||
|
||||
<script type="text/javascript" src="js/firefly.js"></script>
|
||||
@yield('scripts')
|
||||
|
||||
|
||||
<script>
|
||||
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
|
||||
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
|
||||
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
|
||||
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
|
||||
|
||||
ga('create', '<?php echo env('ANALYTICS_ID', 'XXX-XX-X'); ?>', 'auto');
|
||||
ga('send', 'pageview');
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -18,7 +18,7 @@
|
||||
<ul class="nav navbar-top-links navbar-right">
|
||||
|
||||
<!-- reminders -->
|
||||
@if($reminders->count() > 0)
|
||||
@if(isset($reminders) && $reminders->count() > 0)
|
||||
<li class="dropdown">
|
||||
<a class="dropdown-toggle" data-toggle="dropdown" href="#" aria-expanded="false">
|
||||
<i class="fa fa-envelope fa-fw"></i> <i class="fa fa-caret-down"></i>
|
||||
|
@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Class TestCase
|
||||
*/
|
||||
@ -20,4 +19,18 @@ class TestCase extends Illuminate\Foundation\Testing\TestCase
|
||||
return $app;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $class
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function mock($class)
|
||||
{
|
||||
$mock = Mockery::mock($class);
|
||||
|
||||
$this->app->instance($class, $mock);
|
||||
|
||||
return $mock;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
<?php
|
||||
use FireflyIII\Models\Preference;
|
||||
|
||||
/**
|
||||
* Generated by PHPUnit_SkeletonGenerator on 2015-03-08 at 20:05:14.
|
||||
@ -30,8 +31,17 @@ class AccountControllerTest extends TestCase
|
||||
public function testCreate()
|
||||
{
|
||||
$this->be(new FireflyIII\User);
|
||||
|
||||
$pref = new Preference;
|
||||
$pref->data = '1M';
|
||||
|
||||
Preferences::shouldReceive('get', 'viewRange')->andReturn($pref);
|
||||
Amount::shouldReceive('getDefaultCurrency')->andReturn(null);
|
||||
|
||||
$response = $this->call('GET', '/accounts/create/asset');
|
||||
$this->assertResponseOk();
|
||||
|
||||
|
||||
$this->assertViewHas('subTitle', 'Create a new asset account');
|
||||
$this->assertViewHas('subTitleIcon', 'fa-money');
|
||||
$this->assertViewHas('what', 'asset');
|
||||
|
Loading…
Reference in New Issue
Block a user