Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import math
- import datetime
- #generate string for date
- date=datetime.datetime.now().strftime("%Y-%m-%d")
- print(date)
- #attributes collected
- total_score=0
- attributes={
- 'Become less apathetic':{
- 'Waking up properly':0, #10, wake up instantly
- 'Not overwhelmed by negative emotion':0, #assuming u wake up prop thats fine
- 'Interest in becoming less apathetic':0, #lack of resent towards waking up
- 'Time used with purpose':0,#didnt waste any time, did stuff i enjoyed or had to do all day
- },
- 'Done school work':{
- 'Present in school ':0, #go to school, focus/no school
- 'No homework related trouble':0, #do homework well
- 'Did revision (followed schedule?)':0, #revise, follow schedule
- 'Interest in doing school work':0 #interest doing the grind
- },
- 'Work harder for GoodByte':{
- 'Make gun system for RvB':0, #finish gun system
- 'Game progress':0, # do all tasks listed
- #'Goodbyte progress':0, # goodbyte improves as group, find way to measure
- 'Interest in work':0 #fascinated by work
- },
- 'Become closer to people':{
- 'Spoke to people':0, #find time to speak to people, see someone irl
- 'Social satisfaction':0, #be happy with people ur talking to
- 'Interest in being socially active':0 #wanting to pursue
- },
- 'Pursued creative endevaours':0, #write about oli/music/read/design
- 'Maintained my physical health':0, #do intense circuit training, go outside
- 'Acted brave, confident and confront my issues':0 #cold shower, do something new
- }
- comments={}
- final_analysis={}
- #collect userdata
- def parse_attribute(att):
- for attribute in att:
- value=att[attribute]
- if value != 0:
- parse_attribute(value)
- else:
- user_input=input(attribute+" out of 10")
- userdata={'score':int(user_input[0:2])}
- #if len(user_input) >2:
- comments[attribute]= user_input[2:len(user_input)]
- att[attribute]=userdata
- #converts attributes into flat dict with data
- def get_final_analysis(index,value,ancestor):
- final_analysis[index]={'score':0,'maxm':0,'ancs':len(ancestor)-2}
- ancestor = ancestor.copy()
- ancestor.append(index)
- #if is end node of recursive tree
- if 'score' in value:
- score=value['score']
- for i in range(1,len(ancestor)):
- key=ancestor[i]
- new_score=final_analysis[key]['score']+score
- new_max=final_analysis[key]['maxm']+10
- ancs=final_analysis[key]['ancs']
- final_analysis[key]={'score':new_score,'maxm':new_max,'ancs':ancs}
- elif isinstance(value,dict):
- #call recursive function to find end node
- for index,attribute in value.items():
- get_final_analysis(index,attribute,ancestor)
- #format and save data
- def clean_final_analysis():
- #log detailed stats
- f=open('data/'+date+'.txt','w+')
- for key,data in final_analysis.items():
- score=str(data['score'])+'/'+str(data['maxm'])
- perc = str(math.floor((data['score']/data['maxm'])*100))+'%'
- comment=''
- if key in comments:
- comment=comments[key]
- f.write((' '*data['ancs'])+key+": "+score+' '+perc+' '+comment)
- f.write("\r\n")
- if key=='total_score':
- f.write("\r\n")
- f.close()
- #print out
- f=open('data/'+str(date)+'.txt','r+')
- print(f.read())
- f.close()
- f=open('data/'+date+'.txt','a+')
- final_comments = input("What are your comments for improvement?")
- f.write("\r\nFinal comments: "+final_comments)
- f.close()
- #log generalised stats
- data_txt=open('general/data.txt','a')
- data=final_analysis['total_score']
- score=str(data['score']) + '/' + str(data['maxm'])
- perc=str(math.floor((data['score']/data['maxm'])*100))+'%'
- data_txt.write(str(date) + ': ' +score+' ' +perc+',\r\n')
- data_txt.close()
- parse_attribute(attributes)
- get_final_analysis('total_score',attributes,['total_score'])
- clean_final_analysis()
- exit()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement