diff --git a/.env.example b/.env.example
index 07b13be62b..fdf834d3ef 100644
--- a/.env.example
+++ b/.env.example
@@ -14,3 +14,4 @@ SESSION_DRIVER=file
EMAIL_SMTP=
EMAIL_USERNAME=
EMAIL_PASSWORD=
+ANALYTICS_ID=
\ No newline at end of file
diff --git a/README.md b/README.md
index 2d54514d55..294aa07bd1 100644
--- a/README.md
+++ b/README.md
@@ -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)
diff --git a/app/Http/Middleware/PiggyBanks.php b/app/Http/Middleware/PiggyBanks.php
index 35b90281a0..0854d338a8 100644
--- a/app/Http/Middleware/PiggyBanks.php
+++ b/app/Http/Middleware/PiggyBanks.php
@@ -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()
diff --git a/app/Http/Middleware/Range.php b/app/Http/Middleware/Range.php
index 7a5f212bc5..b26daf51b2 100644
--- a/app/Http/Middleware/Range.php
+++ b/app/Http/Middleware/Range.php
@@ -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 {
diff --git a/app/Http/Middleware/Reminders.php b/app/Http/Middleware/Reminders.php
index 55c555aec0..457e4e2543 100644
--- a/app/Http/Middleware/Reminders.php
+++ b/app/Http/Middleware/Reminders.php
@@ -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;
diff --git a/app/Repositories/Account/AccountRepository.php b/app/Repositories/Account/AccountRepository.php
index 92215550dd..9fc94b9bdf 100644
--- a/app/Repositories/Account/AccountRepository.php
+++ b/app/Repositories/Account/AccountRepository.php
@@ -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) {
diff --git a/app/Repositories/Journal/JournalRepository.php b/app/Repositories/Journal/JournalRepository.php
index e89e631406..1c726ae6dc 100644
--- a/app/Repositories/Journal/JournalRepository.php
+++ b/app/Repositories/Journal/JournalRepository.php
@@ -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.*']);
+ }}
diff --git a/app/Repositories/Journal/JournalRepositoryInterface.php b/app/Repositories/Journal/JournalRepositoryInterface.php
index cf10d0e557..5e89501790 100644
--- a/app/Repositories/Journal/JournalRepositoryInterface.php
+++ b/app/Repositories/Journal/JournalRepositoryInterface.php
@@ -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();
}
diff --git a/database/migrations/2014_12_13_190730_changes_for_v321.php b/database/migrations/2014_12_13_190730_changes_for_v321.php
index 9b4c82db98..b381e774ab 100644
--- a/database/migrations/2014_12_13_190730_changes_for_v321.php
+++ b/database/migrations/2014_12_13_190730_changes_for_v321.php
@@ -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()');
}
diff --git a/resources/views/layouts/default.blade.php b/resources/views/layouts/default.blade.php
index 685112e0ae..e0c8eea327 100644
--- a/resources/views/layouts/default.blade.php
+++ b/resources/views/layouts/default.blade.php
@@ -121,19 +121,31 @@
@yield('scripts')
+
+
+