Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does not work for timesheet weeks that start on Sunday, rather than Monday #30

Open
twohue opened this issue Jan 22, 2015 · 9 comments
Open

Comments

@twohue
Copy link

twohue commented Jan 22, 2015

I love this freaking extension, really, truly, honestly, I do, but I am going to kick babies if this thing screws up my entries again.

Just for kicks, I checked out what day 7/14/2014 was (from the extension screenshot) and sure enough, it was Monday.

I can't get my company to change the way the weeks are in OA, and try as I might, I cannot figure out how to fix it in the code. I've looked at every last file, poured over every last detail, and it still eludes me.

PLEASE fix this so that it's flexible about the week starting day. I will buy you beer, I will bring you hookers and blackjack. Just help me.

@crittermike
Copy link
Contributor

That was such a passionate plea, how can I say no? Can you please send me a
screenshot of an empty timesheet that starts with Sunday as well as a copy
and paste of the html (view source), so that I have something to work with?
I can't get my company to make my week start on Sunday for me to work on
this.

On Wed, Jan 21, 2015, 7:23 PM Alex notifications@github.com wrote:

I love this freaking extension, really, truly, honestly, I do, but I am
going to kick babies if this thing screws up my entries again.

Just for kicks, I checked out what day 7/14/2014 was (from the extension
screenshot) and sure enough, it was Monday.

I can't get my company to change the way the weeks are in OA, and try as I
might, I cannot figure out how to fix it in the code. I've looked at every
last file, poured over every last detail, and it still eludes me.

PLEASE fix this so that it's flexible about the week starting day. I will
buy you beer, I will bring you hookers and blackjack. Just help me.


Reply to this email directly or view it on GitHub
#30.

@twohue
Copy link
Author

twohue commented Jan 26, 2015

Thank you SOOOOO MUCH, you have no idea what this will mean to me, and everyone else that has to deal with OA at my company. Total lifesaver.

I've e-mailed you directly with the requested resources. Please let me know if you need anything else.

Eternally grateful,

-Alex

@crittermike
Copy link
Contributor

Hey Alex, haven't gotten it yet, did you send to mikecrittenden@gmail.com ?

On Mon Jan 26 2015 at 10:31:34 AM Alex notifications@github.com wrote:

Thank you SOOOOO MUCH, you have no idea what this will mean to me, and
everyone else that has to deal with OA at my company. Total lifesaver.

I've e-mailed you directly with the requested resources. Please let me
know if you need anything else.

Eternally grateful,

-Alex


Reply to this email directly or view it on GitHub
#30 (comment)
.

@twohue
Copy link
Author

twohue commented Jan 26, 2015

Zip hosted and link e-mailed. Thanks.

@crittermike
Copy link
Contributor

Got it!

On Mon Jan 26 2015 at 10:55:45 AM Alex notifications@github.com wrote:

Zip hosted and link e-mailed. Thanks.


Reply to this email directly or view it on GitHub
#30 (comment)
.

@twohue
Copy link
Author

twohue commented Apr 6, 2015

Hey buddy, checking in on this - I'm desperate. Can I place a bounty on this feature?

Shall we start the bribing at, say - $25.00?

@crittermike
Copy link
Contributor

Wow, I really screwed the pooch on this one.

I spent some time with it tonight, and it's proving to be near impossible for me to fix this in a way that I can be sure that it's fixed without being able to set it up so that Sunday is the first day on my end. I tried dropping in the markup that you sent and that didn't do it because OpenAir does a lot of wild stuff on page load before I can get to it.

That said, it seems like some combination of altering the following is the fix:

  1. $scope.getDaysArray function in timeentry.js
  2. $scope.weekdays array in timeentry.js
  3. getDayNum function in openair.js

Sorry I couldn't be more helpful here. I'll leave this open in case anyone else wants to come along and help out.

@mattdurf
Copy link

I'm late to this party/discussion, but just came across this extension in trying to make my timekeeping life a little less hellish. I love this extension, but was having the same issue as other users here since our work week is configured to start on Saturdays, so all entries are two days off when saving.

I think I have found a simple fix for this, so wanted to make a suggestion. As mentioned above, in OpenAir.js, there is a function at line 391 - GetDayNum. I was able to get my situation to work flawlessly by simply modifying the order of the array defined in this function so that Saturday is index 0, Sunday index 1, and so on:

    /**
     * Helper function to convert two digit day code to integer.
     *
     * @TODO: Start using numbers instead of day codes. It'll remove a lot of dumb logic.
     *
     * @param {string} dayCode
     * @returns {int}
     */
    this.getDayNum = function(dayCode) {
        var  weekdays = [];
        weekdays.sa = 0;
        weekdays.su = 1;
        weekdays.mo = 2;
        weekdays.tu = 3;
        weekdays.we = 4;
        weekdays.th = 5;
        weekdays.fr = 6;
        return weekdays[dayCode];
    };

To make this universally configurable, it would be good to have a new setup item on the Options page to specify your OpenAir weekday order, or just starting day of the week. Then this function would properly order the array based on that input for a given OA schedule.

I'm a hack who is good at reading code and making small modifications, but not necessarily wholesale changes like this, so I am not going to branch this change myself, but wanted to make the suggestion for others who are more capable to implement.

@pangolingo
Copy link

If anyone is still using this extension, would you mind checking out PR #37 to see if this solves your problem?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants