timeoff-management / timeoff-management-application

Simple yet powerful absence management software for small and medium size business (community edition)
https://TimeOff.Management
MIT License
951 stars 588 forks source link

Failure to show users page when one of the approvers got to be removed. #56

Closed vpp closed 8 years ago

vpp commented 8 years ago

I have deleted a former employee from the system this morning, but now when clicking to show the list of employees:

TypeError: Cannot read property 'user' of undefined at sequelize.define.instanceMethods.get_deducted_days (/home/vpp/webapps/timeoff_management_app/application/lib/model/db/leave.js:308:48) at sequelize.define.instanceMethods.get_deducted_days_number (/home/vpp/webapps/timeoff_management_app/application/lib/model/db/leave.js:268:29) at /home/vpp/webapps/timeoff_management_app/application/lib/model/mixin/user/absenceaware.js:278:39 at Function..map._.collect (/home/vpp/webapps/timeoff_management_app/application/node_modules/underscore/underscore.js:172:24) at calculate_number_of_days_taken_from_allowence (/home/vpp/webapps/timeoff_management_app/application/lib/model/mixin/user/absence_aware.js:273:9) at lambda (/home/vpp/webapps/timeoff_management_app/application/node_modules/express-handlebars/node_modules/handlebars/dist/cjs/handlebars/runtime.js:109:54) at eval (eval at createFunctionContext (/home/vpp/webapps/timeoff_management_app/application/node_modules/express-handlebars/node_modules/handlebars/dist/cjs/handlebars/compiler/javascript-compiler.js:254:23), :13:14) at prog (/home/vpp/webapps/timeoff_management_app/application/node_modules/express-handlebars/node_modules/handlebars/dist/cjs/handlebars/runtime.js:219:12) at execIteration (/home/vpp/webapps/timeoff_management_app/application/node_modules/express-handlebars/node_modules/handlebars/dist/cjs/handlebars/helpers/each.js:51:19) at Object. (/home/vpp/webapps/timeoff_management_app/application/node_modules/express-handlebars/node_modules/handlebars/dist/cjs/handlebars/helpers/each.js:61:13) at Object.eval (eval at createFunctionContext (/home/vpp/webapps/timeoff_management_app/application/node_modules/express-handlebars/node_modules/handlebars/dist/cjs/handlebars/compiler/javascript-compiler.js:254:23), :13:31) at main (/home/vpp/webapps/timeoff_management_app/application/node_modules/express-handlebars/node_modules/handlebars/dist/cjs/handlebars/runtime.js:173:32) at ret (/home/vpp/webapps/timeoff_management_app/application/node_modules/express-handlebars/node_modules/handlebars/dist/cjs/handlebars/runtime.js:176:12) at ret (/home/vpp/webapps/timeoff_management_app/application/node_modules/express-handlebars/node_modules/handlebars/dist/cjs/handlebars/compiler/compiler.js:525:21) at ExpressHandlebars._renderTemplate (/home/vpp/webapps/timeoff_management_app/application/node_modules/express-handlebars/lib/express-handlebars.js:247:12) at ExpressHandlebars. (/home/vpp/webapps/timeoff_management_app/application/node_modules/express-handlebars/lib/express-handlebars.js:173:21) at tryCallOne (/home/vpp/webapps/timeoff_management_app/application/node_modules/express-handlebars/node_modules/promise/lib/core.js:37:12) at /home/vpp/webapps/timeoff_management_app/application/node_modules/express-handlebars/node_modules/promise/lib/core.js:123:15 at flush (/home/vpp/webapps/timeoff_management_app/application/node_modules/express-handlebars/node_modules/promise/node_modules/asap/raw.js:50:29) at process._tickCallback (node.js:419:13)

vpp commented 8 years ago

This issue is due to broken association: leave uses approver to obtain the public holidays, but it should use the user.