Open enordstrand opened 3 years ago
Any suggestions on this?
Any solutions to this? Would be really appreciated if you could look at this.
Please let me know if there are anything I can help with to solve this issue. Any help will be much appreciated.
I'm starting to look a little into this myself, but it seems like I need some support. In absence_aware.js at the bottom, there is a if-sentence: if (would_be_used > leave_type.limit). The solution might be to change it to something like: if (would_be_used > leave_type.limit + allowanceAdjustment), but I'm not able to find the adjustment-variable.
Any ideas ot this?
I just had the same problem and this is the quick hack I was able to implement to make it work:
index 41f0366..e944600 100644
--- a/lib/model/mixin/user/absence_aware.js
+++ b/lib/model/mixin/user/absence_aware.js
@@ -580,11 +580,12 @@ module.exports = function(sequelize){
)
.then(employee =>
employee.promise_allowance({year})
- .then(allowance_obj => Promise.resolve([allowance_obj.number_of_days_available_in_allowance, employee]))
+ .then(allowance_obj => Promise.resolve([allowance_obj.number_of_days_available_in_allowance, employee, allowance_obj]))
)
.then(function(args){
let days_remaining_in_allowance = args[0],
- employee = args[1];
+ employee = args[1],
+ allowance_obj = args[2];
let deducted_days = leave.get_deducted_days_number({
year : year.format('YYYY'),
@@ -603,12 +604,15 @@ module.exports = function(sequelize){
throw error;
}
- return Promise.resolve(employee);
+ return Promise.resolve([employee, allowance_obj]);
})
// Check that adding new leave of this type will not exceed maximum limit of
// that type (if it is defined)
- .then(function(employee){
+ .then(function(args){
+ let employee = args[0],
+ allowance_obj = args[1];
+
if (
// There is a limit for current type
leave_type.limit
@@ -630,7 +634,7 @@ module.exports = function(sequelize){
ignore_allowance : true,
});
- if (would_be_used > leave_type.limit) {
+ if (would_be_used > (leave_type.limit + allowance_obj.manual_adjustment)) {
var error = new Error('Adding requested '+leave_type.name
+" absence would exceed maximum allowed for such type by "
Thanks a lot! I will test this out next week! :)
@neotest-io that helped get me most of the way there I had to also allow for carry_over time in the last check
if (would_be_used > (leave_type.limit + (allowance_obj.manual_adjustment+ allowance_obj.carry_over))) { var error = new Error('Adding requested '+leave_type.name +" absence would exceed maximum allowed for such type by "
Thanks for your help in narrowing that down!
Tested now, neotest-io together with simonbrowning change, and it worked perfect!
Thanks a lot both of you! For the reference, attached a patch containing the updated absence_aware.js and updated Dockerfile. Just extract the zip, and have both files in the same directory, and then run: docker build --tag timeoff-management . and then docker run --restart always --publish 3000:3000 -d --name timeoff timeoff-management
Could this change be added to the original code?
Tested now, neotest-io together with simonbrowning change, and it worked perfect!
Thanks a lot both of you! For the reference, attached a patch containing the updated absence_aware.js and updated Dockerfile. Just extract the zip, and have both files in the same directory, and then run: docker build --tag timeoff-management . and then docker run --restart always --publish 3000:3000 -d --name timeoff timeoff-management
Could this change be added to the original code?
Hi
ty will this work if i dont have it installed already, so i just copy this onto my server and run them two commands
Kind regards
Yes, that is the intention. The dockerfile contains the command to git-clone the original repository, and then the Dockerfile will replace the old absence_aware.js with the one in this patch. After that, it will run npm install and set up everything for you.
You should then be able to go to localhost:3000 or what ever your server domain/ip is, and register a new company.
guys, please have a look at https://github.com/timeoff-management/timeoff-management-application/issues/458#issuecomment-749480274
Hello, and thanks a lot for a really great tool!
I have an issue with the Allowance adjustment. I have a user with 3 available holliday (out of 25) left, and I have set the Allowance adjustment to 2.
In the Absences view of a user's details, under Overview, it says with a green bar: 22 days used so far. And the orange bar says 5 remaining days.
Further down it says Holiday: 22 out of 25 And it also says "Individual adjustment: 2"
But when I try to create a new absence of 5 days holliday, it says: "Error: Adding requested Holiday absence would exceed maximum allowed for such type by 2"
How can i spend the days given in "Individual adjustment"?