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

Add a flag to display 'Details' section when running report --from<> --to<> #17

Closed
beevabeeva opened this issue Jul 13, 2019 · 1 comment

Comments

@beevabeeva
Copy link

beevabeeva commented Jul 13, 2019

Hi @larose + contributors,

thank you for developing and sharing this great tool!

I skimmed through the source code to try and figure out how to add this feature myself.
Your python skills are way more pythonic than mine however, and I didn't get very far.
Edit: Completing #18 will probably take my Python skills to the next level - so thanks for that. I might be able to add this feature myself!

Here is what I wanted to do:

  • adding a new -d (for details) argument
    utt report --from 2019-07-12 --to 2019-07-13 -d
  • desired output:
------ Friday, Jul 12, 2019 (week 28) to Saturday, Jul 13, 2019 (week 28) ------

Working Time: 15h00
Break   Time: 0h00


----------------------------------- Projects -----------------------------------

(15h00) OS: Bring tutors up to speed, create google forms for  
new student repos, setting up course (Github website/repos  
etc + liasing with staff to organise things), Update website, write  
script to create new student repos, write script to delete old  
repos, write script to scrape and backup old homework repos

---------------------------------- Activities ----------------------------------

(1h00) OS: Bring tutors up to speed
(1h00) OS: create google forms for new student repos
(5h00) OS: setting up course (Github website/repos etc + liasing with staff to organise things)
(1h00) OS: Update website
(5h00) OS: write script to create new student repos
(1h00) OS: write script to delete old repos
(1h00) OS: write script to scrape and backup old homework repos


----------------------------------- Details ------------------------------------
2019-07-12:
(5h00) 12:00-17:00 OS: setting up course (Github website/repos etc + liasing with staff to organise things)

2019-07-13 :
(1h00) 12:00-13:00 OS: Update website
(1h00) 13:00-14:00 OS: Bring tutors up to speed
(1h00) 14:00-15:00 OS: write script to scrape and backup old homework repos
(1h00) 15:00-16:00 OS: write script to delete old repos
(1h00) 16:00-17:00 OS: create google forms for new student repos
(5h00) 17:00-22:00 OS: write script to create new student repos

The date separated activities aren't important. I guess having:

 ...
----------------------------------- Details ------------------------------------
(5h00) 12:00-17:00 OS: setting up course (Github website/repos etc + liasing with staff to organise things)
(1h00) 12:00-13:00 OS: Update website
(1h00) 13:00-14:00 OS: Bring tutors up to speed
(1h00) 14:00-15:00 OS: write script to scrape and backup old homework repos
(1h00) 15:00-16:00 OS: write script to delete old repos
(1h00) 16:00-17:00 OS: create google forms for new student repos
(5h00) 17:00-22:00 OS: write script to create new student repos

is fine too.

Mainly, this feature would allow one to see the actual date-time of the hours worked.

I could achieve this with a script that reads the contents of utt.log,
formats the outputt to look like the 'Details' section, and finally printing it after calling
utt report --from<> --to<>.

Something like this:

note this is just pseudo code

from os import system
import sys


# make a file that holds the desired output
output=open('output.txt','w+') 

#Get the time period as argument to script:
from_date = sys.argv[1]
to_date = sys.argv[2]

# Get time period (pseudo code)
period = to_date - from_date

#store the detailed activities here:
details = []

# Go through utt.log lookng for matching dates (psseudo code)
f='utt.log'
with open(f) as file_object:
    for line in file_object:
        if(line is within period):
        	details.append(line.rstrip()) # add activities occring in period


# run the report command as it is now:
run = "utt report --from "+from_date+" --to "+to_date
sys(run>>output.txt) # put the output in a textfile, we don't want it printing to terminal just yet...


# add the details that we got earlier, to the output file;
st = '----------------------------------- Details ------------------------------------\n'
output.write(st)
for d in details:
	output.write(d+"\n")


output.close()
# finally output everything to the terminal
sys("cat output.txt")

This is a hack though, and I'm quite sure you'd be able to do this far easier and more elegantly
knowing the source code structure 😋
Thanks again for this awesome tool.

ukrutt added a commit to ukrutt/utt that referenced this issue Nov 5, 2019
Missing a "date divider" which IMO is a necessity.

This is work towards a solution for
larose#17

Attn @beevabeeva, you might be interested in this.
ukrutt added a commit to ukrutt/utt that referenced this issue Nov 5, 2019
@ukrutt ukrutt mentioned this issue Nov 5, 2019
@ukrutt ukrutt mentioned this issue Nov 18, 2019
@larose
Copy link
Owner

larose commented Dec 7, 2019

This featured has been added in 3918029

@larose larose closed this as completed Dec 7, 2019
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

Successfully merging a pull request may close this issue.

2 participants