Skip to content

Commit

Permalink
Merge pull request #80 from AppBakerZ/ReportsBugs
Browse files Browse the repository at this point in the history
Report bug fixing issue #45
  • Loading branch information
Furqankhanzada authored Apr 10, 2017
2 parents b6ff4b5 + 6cbfe67 commit 6821c80
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
9 changes: 6 additions & 3 deletions imports/api/statistics/methods.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ import { Expenses } from '../expences/expenses.js';
import { Incomes } from '../incomes/incomes.js';
import { Accounts } from '../accounts/accounts.js';
import { Categories } from '../categories/categories.js';
import { accountHelpers } from '/imports/helpers/accountHelpers.js'


export const incomesGroupByMonth = new ValidatedMethod({
name: 'statistics.incomesGroupByMonth',
Expand Down Expand Up @@ -256,10 +258,11 @@ export const generateReport = new ValidatedMethod({
/*Todo use later relation */
Template.report.helpers({
accountName : (id) => {
return Accounts.findOne({_id : id, owner: this.userId}).name;
let account = Accounts.findOne({_id : id, owner: this.userId});
return accountHelpers.alterName(account.bank)
},
categoryName : function(id){
return Categories.findOne({_id : id}).name;
categoryName : function(category){
return Categories.findOne({_id : category._id}).name;
},
totalIncome : function(){
if(params.date){
Expand Down
9 changes: 9 additions & 0 deletions imports/ui/components/dashboard/Dashboard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,15 @@ class DashboardPage extends Component {
date : dateHelpers.filterByDate(this.state.filterBy, {}, this),
report : report
};
// prevent window popup block
let win = window.open('');
win.document.write("<p> Loading...</p>");
window.oldOpen = window.open;
window.open = function(url) {
win.location = url;
window.open = oldOpen;
win.focus();
}

Meteor.call('statistics.generateReport', {params } , function(err, res){
if (err) {
Expand Down

0 comments on commit 6821c80

Please sign in to comment.