From 2d6ccc146263d4d822b07bea7f4a2a353cf4d9cc Mon Sep 17 00:00:00 2001 From: muahahahh Date: Sat, 16 Jan 2021 23:56:16 +0100 Subject: [PATCH] removed sqlite from git --- .gitignore | 3 +- README.md | 19 ++++ .../__pycache__/urls.cpython-38.pyc | Bin 656 -> 795 bytes .../calendar_ajax_employee_module_config.js | 10 +-- .../employee_module_change_employee_data.js | 2 +- .../js/employee_module_show_employee_data.js | 2 +- employee_module/urls.py | 14 +-- hr_module/__pycache__/forms.cpython-38.pyc | Bin 987 -> 1016 bytes hr_module/__pycache__/urls.cpython-38.pyc | Bin 1023 -> 1192 bytes hr_module/__pycache__/views.cpython-38.pyc | Bin 11641 -> 12180 bytes hr_module/forms.py | 8 +- .../data_import_functions.cpython-38.pyc | Bin 1825 -> 2208 bytes .../__pycache__/insert_to_plan.cpython-38.pyc | Bin 3702 -> 0 bytes .../insert_to_plan_class.cpython-38.pyc | Bin 0 -> 4228 bytes .../__pycache__/misc.cpython-38.pyc | Bin 643 -> 0 bytes .../monthly_planning_functions.cpython-38.pyc | Bin 2482 -> 1659 bytes .../__pycache__/util.cpython-38.pyc | Bin 0 -> 1148 bytes .../data_import_functions.py | 22 +++-- .../monthly_planning_functions.py | 81 ++++-------------- hr_module/handling_functions/util.py | 19 +++- .../js/calendar_ajax_hr_module_config.js | 12 +-- .../static/js/calendar_ajax_hr_module_main.js | 1 + .../js/calendar_ajax_hr_module_requests.js | 3 + hr_module/static/js/calendar_extended.js | 4 +- hr_module/static/js/calendar_to_table.js | 19 +++- hr_module/static/js/hr_module_base.js | 1 + .../js/hr_module_change_employee_data.js | 2 +- .../static/js/hr_module_create_schedule.js | 24 ++++-- hr_module/static/js/hr_module_export.js | 9 +- hr_module/templates/hr_module_base.html | 2 +- hr_module/templates/hr_module_import.html | 2 +- hr_module/urls.py | 22 ++--- hr_module/views.py | 66 ++++++++------ timefall/__pycache__/settings.cpython-38.pyc | Bin 2991 -> 2990 bytes timefall/__pycache__/urls.cpython-38.pyc | Bin 1476 -> 1493 bytes timefall/settings.py | 2 +- timefall/urls.py | 6 +- 37 files changed, 197 insertions(+), 158 deletions(-) delete mode 100644 hr_module/handling_functions/__pycache__/insert_to_plan.cpython-38.pyc create mode 100644 hr_module/handling_functions/__pycache__/insert_to_plan_class.cpython-38.pyc delete mode 100644 hr_module/handling_functions/__pycache__/misc.cpython-38.pyc create mode 100644 hr_module/handling_functions/__pycache__/util.cpython-38.pyc diff --git a/.gitignore b/.gitignore index a1d5f8b..3497701 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,5 @@ venv/ venv media -media/ \ No newline at end of file +media/ +db.sqlite3 \ No newline at end of file diff --git a/README.md b/README.md index e69de29..890cd40 100644 --- a/README.md +++ b/README.md @@ -0,0 +1,19 @@ + +# Timefall - time tracking app +This application is designed for schedule creating and time tracking activities within the enterprise. +Application consists of two parts: +1. HR Module - module for HR administration employees and managers. + The module has the following functionality: + 1. Creating of schedule + 2. Showing and editing existing schedule records + 3. Showing and editing employees logged time + 4. Changing employee data + 5. Creating new employees via frontend or importing from excel + 6. Exporting reports in excel format via frontend + +2. Employee module - module for employees. + The module has the following functionality: + 1. Logging in start and end of work + 2. Showing existing schedule records + 3. Showing existing logged time + 4. Showing employee data \ No newline at end of file diff --git a/employee_module/__pycache__/urls.cpython-38.pyc b/employee_module/__pycache__/urls.cpython-38.pyc index 173202a60214fb4a542cf3b53a50d2f4c718eaac..5fd7dd2d299daed0d8c50f11e9f2ae338a6763d4 100644 GIT binary patch delta 387 zcmZ9`J&wXK5CveOh=l~3pTM%(BT(cP^b}}?L}RRs6~Y=4EkOu3oB#<#xg{5(_GxfN z4k)<$-aL=yT>t+dKa~14^JdarTnLXmXq;T(fG^yY2Q4dNQ`wn`~l@WF-~dF4KLujg|s-QfMSAsR&Ms z1u~5_idm^4&cr&C=|PAvlYA5MEYX;=GQUn7@2I}3UAqG7IC|F0?aXXaLG>5#oNLTp Q^&)$}q{u3l+|G{k0Dj(tga7~l delta 255 zcmbQuHi4BVl$V!_0SIos`xQTtCo!2Lg}s+Kl`(}gl{t$ug%ir-0`j<0xS%|4AdfqR z8_MGW@_15spgdk6k2i%E%Hsp__)_>lymXEz{uKUT22Fv97hLLZ@s?!frpA{PB_?NQ z=B3}_EzZaf1M^aI3v%)+Q&Zy$auW066ALnLNur8F Vm4l^(P^D55OA?WdnJmZj7Xb0QRWJYm diff --git a/employee_module/static/js/calendar_ajax_employee_module_config.js b/employee_module/static/js/calendar_ajax_employee_module_config.js index cbb1310..cac5067 100644 --- a/employee_module/static/js/calendar_ajax_employee_module_config.js +++ b/employee_module/static/js/calendar_ajax_employee_module_config.js @@ -1,13 +1,13 @@ const urls = { - 'show_schedule': { - 'show': '/employee_module/show_employee_plan_api', + 'show-schedule': { + 'show': '/employee-module/show-employee-plan-api', 'update': '/employee_module/update_plan_api' } , - 'show_timelog': { - 'show': '/employee_module/show_employee_timelog_api', - 'update': '/employee_module/update_timelog_api', + 'show-timelog': { + 'show': '/employee-module/show-employee-timelog-api', + 'update': '/employee-module/update-timelog-api', } } diff --git a/employee_module/static/js/employee_module_change_employee_data.js b/employee_module/static/js/employee_module_change_employee_data.js index aa54856..9e091f3 100644 --- a/employee_module/static/js/employee_module_change_employee_data.js +++ b/employee_module/static/js/employee_module_change_employee_data.js @@ -7,7 +7,7 @@ searchEmployeeButton.addEventListener('click', function(){ function fetchSearchEmployeeData() { var host = 'http://' + window.location.host; - var fetch_url = host + '/hr_module/change_employee_data_api' + var fetch_url = host + '/hr-module/change-employee-data-api' var username = document.getElementById('username_input').value fetch(fetch_url, diff --git a/employee_module/static/js/employee_module_show_employee_data.js b/employee_module/static/js/employee_module_show_employee_data.js index a87c2f4..1d10f76 100644 --- a/employee_module/static/js/employee_module_show_employee_data.js +++ b/employee_module/static/js/employee_module_show_employee_data.js @@ -6,7 +6,7 @@ window.addEventListener('load', function(){ function fetchSearchEmployeeData() { var host = 'http://' + window.location.host; - var fetch_url = host + '/employee_module/show_employee_data_api' + var fetch_url = host + '/employee-module/show-employee-data-api' fetch(fetch_url, { diff --git a/employee_module/urls.py b/employee_module/urls.py index a9ad2ad..d590893 100644 --- a/employee_module/urls.py +++ b/employee_module/urls.py @@ -7,12 +7,12 @@ app_name = 'employee_module' urlpatterns = [ path('home', views.homepage, name='homepage'), - path('time_tracking', views.time_tracking, name='time_tracking'), - path('show_schedule', views.show_schedule, name='show_schedule'), - path('show_timelog', views.show_timelog, name='show_timelog'), - path('show_employee_plan_api', views.show_employee_plan_api, name='show_employee_plan_api'), - path('show_employee_timelog_api', views.show_employee_timelog_api, name='show_employee_timelog_api'), - path('show_employee_data', views.show_employee_data, name='show_employee_data'), - path('show_employee_data_api', views.show_employee_data_api, name='show_employee_data_api'), + path('time-tracking', views.time_tracking, name='time_tracking'), + path('show-schedule', views.show_schedule, name='show_schedule'), + path('show-timelog', views.show_timelog, name='show_timelog'), + path('show-employee-plan-api', views.show_employee_plan_api, name='show_employee_plan_api'), + path('show-employee-timelog-api', views.show_employee_timelog_api, name='show_employee_timelog_api'), + path('show-employee-data', views.show_employee_data, name='show_employee_data'), + path('show-employee-data-api', views.show_employee_data_api, name='show_employee_data_api'), ] \ No newline at end of file diff --git a/hr_module/__pycache__/forms.cpython-38.pyc b/hr_module/__pycache__/forms.cpython-38.pyc index 03e027dbde68b7a70c9c4cd614ca5b8bdb532f5f..ae888bb4fc4e56ace10b49dd28276d46c451a2ce 100644 GIT binary patch delta 114 zcmcc3{)3%2l$V!_0SMaCnG=3*ulv-GtS(KVGIiKkdD-R)l$V!_0SH_i&&D6#$a{d1v1al)Mq7~uTnibZxKo+IG!KNHtj(mt0~QcU bVGd@{WSJb#q%gUM=?^OhBM?sRWzGfw31@`R-POchfr}?GEJEFTn zzVt(uzia2$LQinZvWO>)XN#hgSIUzT#wtv=Y~_atn+OXl<_Qnbs{%1pb&RtpeMJ17 zlIzW}DXdKfd`)RSYq~q3tN!&O#wZO6lg5$7q&|&ewU#P*)kPka)Q&y6=6^e7wLaJ1 zg**w6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n-^;osT&?PJp3*7r!6Zl1&dPt0zGAIrT_o{ diff --git a/hr_module/handling_functions/__pycache__/insert_to_plan.cpython-38.pyc b/hr_module/handling_functions/__pycache__/insert_to_plan.cpython-38.pyc deleted file mode 100644 index ad476a848dccbf6303bddf9ba179fe5ca2e7777b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3702 zcmbVP&2J<}6|buPoc4^@aW=baBEb1DFp$^>KtfB1mJkAmV6C*yA+4ZR?^KUH z>Y82I^l;f+SK=IUm^tnlDQAux_zUU^m-!P&IPiPb-tmlaq`+A9x;|dL`gp(kz2}cQ zorvN0=fC_b32!m>4{EIb95n8sRPRAZCV9?cj<3kY$cdei8@nSf_Bf3>xjzcxz}9&l z#;xBl=}PZYCcUR3jwFA;y8Z%o*kRW(?)^M1O!({3I4{q#%mhb+QTAbZ+~p>$GOY*2 zan&Q`)t^A)9!m8-L}s@V3(2MUl*Nv8q>C?>ls>+m3}lF}FIzIgH;@~$jc+JBaueT{ zynzjEndqajOm#-v>5=^xKdQSZze1@#gQ&UWJFI32(|jmq4%%V|$DRxHxywFx+2<|$ zJoNc$R7^jc3{NVms?<7^D`>Gsf zJzX7;rGA>{2PcY_o8;NSNm|GpSWNnp0yk0?)xn^^O=Ev$G6rV$$7d!?l0h-hNkWII zZbC2~@tgR&!?#h}vgQ2cOQh|;n9<{;eev`0rT1td_eWHY*_3Ozc?js;23+1}zwb{0 zx1rF^(5;0O&(J@001~fu=6vd6%&(nUFlReV9o24igt3su@GhOHSGdxhdNrT5pc&Pe zIov=2%!ZxXliue(X+GMn?Q1<;(Dt5lbqAj~9E`@L(wRJetq;6pa#v2WU0v?>%A%hS za6QHGZuvM`F@euGzFg2CZ1Q%yfZ;}$hrxD*F^^Tep@H#;O$0nawyAX`Ka5$pkv28kv37F1jO zoceZ2yheh+ZrmrOI_+*MhZ;fo&{BhOz&jQ~=9LDDgpFcwe4>-;WYE`&!o?MMfqy_V z7RzdzhQCLGVhT29f%g{bV8jVAeE3X)nM!2z88t6 z)#ff*G`7i6Z(5@LKWLx7x`NTG?`aLD1koi-|AxjTOcBHQGcgq!G=(@PPF?laT7bYl zn>yMX`m>;Rh9IV4Yc8hlT2F)?M7r6=9F%n`RKMmJZ&NZsuq*)hsedtppx=RhaM7k` zK=VVrS-W*mdv#c&k8C~lIitQ)uD+oDQ%`+Cr1${OMEVcdqt`)>_*w`Bhh4D(9zw>^ zB~m`<-e?^DWAq!pKgbah8+bT*Rx~c(q_Ln^jvfw*>?#I-iopgCHUN5K1;*;OEG*)- zg;>_aN%b>Q{SidGP53C#PY7uue7v>R2cnBNEr*r;q>rFfoy0dM#hQ){|MB*fUZTi# zic{amnjfQ7#E%T5Mj!&YiCutii{C==MI_GOT!G8i^7LAuqqjxpw)A#{ie@w5MIxZV ze_}}VBoN?8dUJoufq)B&la38}q876dc@ZaxjHo4DAnZfw!GD)NT>KM3$hz%0H^FF7 zOmtS+XMXfSH@b9FlZCjH{}{hfGk%2tgG;fGmO$RPkRsu8$NI^5_9~5Y&E1iIbCk;F z*L)ZEc8j~>eD}ZZ>I#v3{XN}>KCxkfcRb1fHn%Vig4O6*FCEJlEix? zE>CXRi=1^8BKV(yO;9RIU6?)Q`R$b>u4Zd%%&~@mpI|QW1u|fpQ$sqoj$9gbWY3Vk zmB^Z9_<4W;C~&6Mp>alKVH`cljPoRusGUrV(^muIRH=rT6y3mj+#Y;EG`*n37sSI0 zin9yayFFO9@vBWK;%)oL)^gsfr>Cg@2b7BLhjD-P?@K>ei}h<9~Br#EP zk!_;hPLfBHG;c=KcVSlTlOXc94^mm?pnF%e{K}T>>!sX8(Sa!Ys>rn=58L6b@F09S zY=yoZ>uxkoC-=u&%Vc-o9=2+jjqb?CD&#~%WM}0*C0~jz%=lwu#c72QE3LijHeted TniTq7y7G!%dx(S>6e9iu(ynNV diff --git a/hr_module/handling_functions/__pycache__/insert_to_plan_class.cpython-38.pyc b/hr_module/handling_functions/__pycache__/insert_to_plan_class.cpython-38.py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V=fu~gmQ6by4K_*NiC@z`fXWA^{YyqSql72UpKST& zaz%gBTQ6OaTe+(hty;WvMXQ$0NZ)8ht3JF1wT`Agd{SmSK2wN;cqAlF!;k<~f`nY3 zof3unkd02-p5ax#0i(-(idLL1h_J<5RQ5VW-=~PqMeRN<<;nf_wsa^Ll#h&P)eaQV z;8wrdU`reo*>PVds-N|=q?_*&icm%fpy6JUP{}tbqU#YWGmzd!8d`mJox3D;oq&!A zr1cV=@<(X=V+8dHB8%;SLidcrfBRkpN{Px%+eMD*wkh4@+)ewNx1PRsf#=I-Zw+a} zd4=>}kvT^i*RlPaoiYvS#FfoXT=|!ZK~z6Kb+k9|XF=r*AeMvHoSnLBB@s$+Y0oz1 zkkJz+dzFp)P4bHf;R1)_)L-_XW3q+z!7@)rhWdwkyK<|b@~W^x8IASKw=F6=vE`Rk ze&We5NvI#k=&6n6rzZ=ytN4T_7Bi z__7!``;L7L!DkVhzHtH3uf0dsE_^!AYrkn%`wG`8Ol{=H_N)eA_`6T0XD$63D#O7ToNBxY$bU!v;x%?#-)*QLJNa1LZ&m!qiHPZeL zr3fH-kD_yf8hL+@$}aJI17*(;6#1JLDBiWF*DqM^qNBYgt!udc6n#lh@wH>VpAb7H zjqfI;@uh^=H!;4Dc=$yCZ-T*8t?5nNjIhk|WsQ3e8^OVYL)iF(wKFV>+RZMlVFpt|AvRw8K}z>)}trSHq1kFm>&X1`7hDv$Oh=xoy^_ z8lff|nd=@d=m5@ed7FG)Nd~L^5gheY!A;?2yq7Ja4&TOb_&)jtnOu>0h4xiaMD`y; CT`DjD literal 0 HcmV?d00001 diff --git a/hr_module/handling_functions/__pycache__/misc.cpython-38.pyc b/hr_module/handling_functions/__pycache__/misc.cpython-38.pyc deleted file mode 100644 index 3cbdcbf991c00778f8fd916dbc50709537dcac00..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 643 zcmZWnv2N5r5S>{cm(y_(h|q+}70At*4>+ADXlPJGlm-c%tX(_jXzew-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1|T?3rd-1{+iuDzNaK=f;r$p$*;vcLPSLVKNW~DfCzwCo;(R| zKhCSidysCB6;eGO#bBI9whhf zy3hRwU*G%W^Sd?%oz&xr%140>B!rpR-eje09#Q+vK=samKe2I{s$zx zJ<*ET{5;E+OQloFzz`yZi*MmY<^B`#F7iy5GR-}-jr!2R93n1nlX_ck!zJ=~TItWp z_0Wl^auK1WfJ=;&nq97POm(;57QEz{yGWPx;t$(D2p>^Atf+}DamZsY4&pF=FCP9M DlpbHW diff --git a/hr_module/handling_functions/__pycache__/util.cpython-38.pyc b/hr_module/handling_functions/__pycache__/util.cpython-38.pyc new file mode 100644 index 0000000000000000000000000000000000000000..3b1ccce71f4c29bb2b5d35f1c770469ee35a634b GIT binary patch literal 1148 zcmZWo&2AGh5VpO$$u@1FDhNS^#9j)D)HWPBR233jxS)y(Au2)GuAOF6?@w)qs?p{` zD*=Zdc!T8FN8nX_<R_qgcvF6-PSisUnNwC>bhUs3_JT^E5I4Jcr5pKs!MC zHn4qo>fOSaR+N)_n(ude!#pu*k?YRTq;jJ?wyjN>YLgUMxz)go zFtr9@WaKjM2?N2U+}M;w5=*@W!p!`?s?h%y##jO7s#+dXLk#^wDtf|BXkD8t0qXLx zHP#!YWt%A+fc2n>=hQZ#*kP9Iy5InA6ozgB)#)+z8~o?F(1}V*tjC74Oxx5p>i*a6 zh#ZA6>;k?wGs7}<2#l~L+G34g>L$nuws^MC3F#S-{shbbA||u~d`#JdP04tsp?@_n z#4+0^W3OTrISADI%A0^Z@j08)DW#-hg8;DPpFv{=4UmE}dY6pZ;TmAeS&jY5ue^h% z8aZDdy-c(6P8@zm+p`g_MarQM#v0*FqM{dNMQ-{!+7sqTh&_5CPZeY?Jzt*`P?;G_#g9<e1$i>DBlZo*D+E#OtuaI^kdwov787P4^e E4^)jB>;M1& literal 0 HcmV?d00001 diff --git a/hr_module/handling_functions/data_import_functions.py b/hr_module/handling_functions/data_import_functions.py index eca6300..96408ea 100644 --- a/hr_module/handling_functions/data_import_functions.py +++ b/hr_module/handling_functions/data_import_functions.py @@ -6,12 +6,11 @@ from sqlalchemy import create_engine from django.contrib.auth.hashers import make_password def create_connection(db_file, type=1): - """ create a database connection to the SQLite database + ''''' create a database connection to the SQLite database specified by the db_file :param db_file: database file :return: Connection object or None - """ - conn = None + ''' try: path = 'sqlite:///' + str(db_file) if type == 1: @@ -25,18 +24,28 @@ def create_connection(db_file, type=1): def read_and_parse_excel(file): + '''function to read exce, save it as a csv file and return html representation of table + :param file - path to the excel file which is to be read + :return returns dictionary with the dataframe in html format and path to the saved file + ''' df = pd.read_excel(file) path_temp = settings.TMP_FILE_STORAGE + file.name.split('.')[0] + '.csv' + print(path_temp) df.to_csv(path_temp) html = df.to_html(index=False, na_rep='') return {'df_html': html, 'df_path': path_temp} def insert_excel(df): + '''void function, inserting pandas dataframe into the database + :param df - dataframe which is to be inserted into the database + ''' conn = create_connection(settings.DATABASES['default']['NAME']) df['date_joined'] = datetime.date.today() + #hashing of default 'start' password df['password'] = make_password('start') + #taking the columns we have to insert into auth_user table df_to_user_model = df[['username', 'first_name', 'last_name', @@ -47,16 +56,19 @@ def insert_excel(df): 'is_superuser', 'password']] + #insert df_to_user_model.to_sql(name='auth_user', con=conn, if_exists='append', index=False) + # taking the columns we have to insert into hr_module_employee table df_to_employee = df[['username', 'department', 'manager_username', 'time_model_id', 'manager_flag']] - + #insert df_to_employee.to_sql(name='hr_module_employee', con=conn, - if_exists='append', index=False) \ No newline at end of file + if_exists='append', index=False) + diff --git a/hr_module/handling_functions/monthly_planning_functions.py b/hr_module/handling_functions/monthly_planning_functions.py index 5e3d8d4..c929faa 100644 --- a/hr_module/handling_functions/monthly_planning_functions.py +++ b/hr_module/handling_functions/monthly_planning_functions.py @@ -7,83 +7,32 @@ import datetime def time_timedelta(time, timedelta): + '''addition of timedelta hours to datetime.time object + :param: time - datetime.time instance + :param timedelta - integer, hours to add + :return datetime.time object + ''' start = datetime.datetime(2020, 1, 1, time.hour, time.minute) end = start + timedelta return end.time() def timediff_hours(time_start, time_end): + '''calculating time difference between end and start time in minutes + :param time_start - time start + :param time_end - time end + :return timedelta in hours + ''' start = datetime.datetime(2020, 1, 1, time_start.hour, time_start.minute, time_start.second) end = datetime.datetime(2020, 1, 1, time_end.hour, time_end.minute, time_end.second) timedelta = (end - start).seconds/3600 return timedelta -def insert_into_plan(user, start_date, end_date, start_time, daily_hours, activity_type, timemodel): - - start_date = datetime.datetime.strptime(start_date, '%Y-%m-%d') - end_date = datetime.datetime.strptime(end_date, '%Y-%m-%d') - start_time = datetime.datetime.strptime(start_time, '%H:%M').time() - - username = Employee.objects.get(username=user) - - daily_hours = int(daily_hours * 60) - end_time = time_timedelta(start_time, datetime.timedelta(minutes=daily_hours)) - - timemodel_pattern = {0: timemodel['mon'], - 1: timemodel['tue'], - 2: timemodel['wed'], - 3: timemodel['thu'], - 4: timemodel['fri'], - 5: timemodel['sat'], - 6: timemodel['sun']} - - days = (end_date - start_date).days - log = [] - for day in range(days + 1): - date_to_add = start_date + datetime.timedelta(days=day) - overlap = check_conflicting_records(username, date_to_add, start_time, end_time) - print(overlap) - if timemodel_pattern[date_to_add.weekday()] and not overlap: - print(date_to_add, start_time, end_time, overlap) - plan = Plan(username=username, - date=date_to_add, - begin_time=start_time, - end_time=end_time, - activity_type=activity_type) - plan.save() - log.append({'username': username.pk, - 'date': date_to_add, - 'begin_time': start_time, - 'end_time': end_time, - 'activity_type': activity_type, - 'status': 'imported'}) - else: - - log.append({'username': username.pk, - 'date': date_to_add, - 'begin_time': start_time, - 'end_time': end_time, - 'activity_type': activity_type, - 'status': 'failed due to conflicting overlap'}) - return log - - -def check_conflicting_records(username, date, start_time, end_time): - plan = Plan.objects.filter(username=username, date=date) - - if len(plan) > 0: - for day in plan: - planned_time_start = day.begin_time - planned_time_end = day.end_time - - if planned_time_start <= end_time and planned_time_end >= start_time: - return True - else: - return False - else: - return False - - def create_planning_operation_report(dict_, current_user): + '''function creating and saving xlsx report from dictionary + :param dict_: dictionary, from which pandas dataframe will be generated + :param current_user + :return saved file name + ''' df = pd.DataFrame(dict_) filename = current_user + '_' + datetime.datetime.now().isoformat() + '.xlsx' path_temp = settings.IMPORT_REPORT_STORAGE + filename diff --git a/hr_module/handling_functions/util.py b/hr_module/handling_functions/util.py index 58416f6..5a6124d 100644 --- a/hr_module/handling_functions/util.py +++ b/hr_module/handling_functions/util.py @@ -1,8 +1,25 @@ +import datetime + def dictfetchall(cursor): "Return all rows from a cursor as a dict" columns = [col[0] for col in cursor.description] return [ dict(zip(columns, row)) for row in cursor.fetchall() - ] \ No newline at end of file + ] + + +def months_list(start_date, end_date): + '''function, returning list of months between dates, including months of both dates''' + start_date = datetime.datetime.strptime(start_date, '%Y-%m-%d').date() + end_date = datetime.datetime.strptime(end_date, '%Y-%m-%d').date() + tmp = end_date + list_ = [] + while tmp >= start_date: + list_.append(tmp.strftime('%Y-%m')) + tmp = tmp.replace(day=1) - datetime.timedelta(days=1) + start_date_str = start_date.strftime('%Y-%m') + if not start_date_str in list_: + list_.append(start_date_str) + return tuple(list_) \ No newline at end of file diff --git a/hr_module/static/js/calendar_ajax_hr_module_config.js b/hr_module/static/js/calendar_ajax_hr_module_config.js index 18583d7..379e4b6 100644 --- a/hr_module/static/js/calendar_ajax_hr_module_config.js +++ b/hr_module/static/js/calendar_ajax_hr_module_config.js @@ -1,13 +1,13 @@ const urls = { - 'show_schedule': { - 'show': '/hr_module/show_employee_plan_api', - 'update': '/hr_module/update_plan_api' + 'show-schedule': { + 'show': '/hr-module/show-employee-plan-api', + 'update': '/hr-module/update-plan-api' } , - 'show_timelog': { - 'show': '/hr_module/show_employee_timelog_api', - 'update': '/hr_module/update_timelog_api', + 'show-timelog': { + 'show': '/hr-module/show-employee-timelog-api', + 'update': '/hr-module/update-timelog-api', } } diff --git a/hr_module/static/js/calendar_ajax_hr_module_main.js b/hr_module/static/js/calendar_ajax_hr_module_main.js index a516dfc..b04e910 100644 --- a/hr_module/static/js/calendar_ajax_hr_module_main.js +++ b/hr_module/static/js/calendar_ajax_hr_module_main.js @@ -6,6 +6,7 @@ import { fetchDays } from './calendar_ajax_hr_module_requests.js' window.addEventListener('load', renderWhole) +//render calendar and add event listeners function renderWhole(){ var parent = document.getElementById('calendar_box') parent.innerHTML = '' diff --git a/hr_module/static/js/calendar_ajax_hr_module_requests.js b/hr_module/static/js/calendar_ajax_hr_module_requests.js index 1dbd5fc..c2e8199 100644 --- a/hr_module/static/js/calendar_ajax_hr_module_requests.js +++ b/hr_module/static/js/calendar_ajax_hr_module_requests.js @@ -4,7 +4,9 @@ import {detailedRecordsMainBlock, formatTableSize} from "./calendar_to_table.js" import { urls } from './calendar_ajax_hr_module_config.js' function fetchDays(){ + //function, fetching records from either schedule or timelog tables, depending on a current host var host = 'http://' + window.location.host; + //url is imported from config file and compared against current location var fetch_url = host + urls[window.location.pathname.substring(window.location.pathname.lastIndexOf('/') + 1)]['show'] var range = searchedDateRange() var startDate = range['min'] @@ -43,6 +45,7 @@ function fetchDays(){ function updateCheckedRecords(recordsArray, action){ + //submitting data with checked records to the database var host = 'http://' + window.location.host; var fetch_url = host + urls[window.location.pathname.substring(window.location.pathname.lastIndexOf('/') + 1)]['update'] diff --git a/hr_module/static/js/calendar_extended.js b/hr_module/static/js/calendar_extended.js index 3e9f9d5..fef92b2 100644 --- a/hr_module/static/js/calendar_extended.js +++ b/hr_module/static/js/calendar_extended.js @@ -49,6 +49,7 @@ function formatCalendarSize(){ } function cleanCalendarClasses(){ + //reset calendar classes to the initial state var classesToKeep = ['days_of_month', 'days_of_month_current', 'days_of_month_today'] var days = document.getElementsByClassName('days_of_month_current') for (var i = 0; i < days.length; i++){ @@ -63,6 +64,7 @@ function cleanCalendarClasses(){ } function addClassToWorkingDays(data){ + //adding class to the calendar cell, indicating that employee has a record in schedule cleanCalendarClasses() for (var i = 0; i < data.length; i++){ var processedDate = data[i]['date'] @@ -73,6 +75,7 @@ function addClassToWorkingDays(data){ } function searchedDateRange(){ + //function, returning earliest and latest visible day of the active months from the calendar var dates = document.getElementsByClassName('days_of_month_current') var datesArray = [] for (var i = 0; i < dates.length; i++){ @@ -83,7 +86,6 @@ function searchedDateRange(){ var maxDate = new Date(Math.max.apply(null, datesArray)) var out = {'min' : minDate, 'max': maxDate} - console.log(out) return out } diff --git a/hr_module/static/js/calendar_to_table.js b/hr_module/static/js/calendar_to_table.js index f93a7a6..ac629c2 100644 --- a/hr_module/static/js/calendar_to_table.js +++ b/hr_module/static/js/calendar_to_table.js @@ -1,24 +1,25 @@ import { updateCheckedRecords } from './calendar_ajax_hr_module_requests.js' -function detailedRecordsMainBlock(data){ - var container = document.createElement('div') +//this file contains functions, used to crate table, containing employee schedule +function detailedRecordsMainBlock(data){ + //add control buttons and table body + var container = document.createElement('div') var buttonsContainer = document.createElement('div') buttonsContainer.id = 'buttons_container' - buttonsContainer.appendChild(addButton('Edit', 'edit', eventListenerEdit)) buttonsContainer.appendChild(addButton('Save', 'save', eventListenerUpdate)) buttonsContainer.appendChild(addButton('Delete', 'delete', eventListenerUpdate)) buttonsContainer.appendChild(addButton('Cancel', 'cancel')) buttonsContainer.appendChild(addButton('Select all/none', 'checkbox_select', eventListenerSelectAll)) - container.appendChild(buttonsContainer) container.appendChild(detailedCalendarRecordsTable(data)) return container } function addButton(innText, name, eventListener=null){ + //add single button var button = document.createElement('button') button.innerHTML = innText button.name = name @@ -32,6 +33,7 @@ function addButton(innText, name, eventListener=null){ function detailedCalendarRecordsTable(data){ + //create table from separate elements var table = createDetailedHeaders() for (var i = 0; i < data.length; i++){ var index = data[i]['id'] @@ -60,6 +62,7 @@ function detailedCalendarRecordsTable(data){ } function eventListenerSelectAll(){ + //function that checks or unchecks all checkboxes var elements = document.getElementsByTagName('input') for (var i = 0; i < elements.length; i++){ if (elements[i].type == 'checkbox' && elements[i].checked == true){ @@ -71,17 +74,20 @@ function eventListenerSelectAll(){ } function eventListenerEdit(){ + //function, added to Edit button unhideCheckboxes() unlockRecordsForEditing() } function eventListenerUpdate(e){ + //function, added to Update button var action = e.target.name var data = getCheckedRecords() updateCheckedRecords(data, action) } function appendCell(tableRow, tag, tagName, tagText, cellIndex){ + //appending cell var cell = tableRow.insertCell(cellIndex) var textInput = document.createElement(tag) textInput.innerText = tagText @@ -91,6 +97,7 @@ function appendCell(tableRow, tag, tagName, tagText, cellIndex){ } function unhideCheckboxes(){ + //function, unhiding checkboxes var checkboxes = document.getElementsByClassName('copy_over_checkbox_cell') for (var i = 0; i < checkboxes.length; i++){ checkboxes[i].style.display = 'initial' @@ -101,6 +108,7 @@ function unhideCheckboxes(){ } function unlockRecordsForEditing(){ + //function, switching div elements to input var rows = document.getElementsByClassName('database_row') for (var j = 0; j < rows.length; j++) { var children = rows[j].getElementsByTagName('div') @@ -121,6 +129,7 @@ function unlockRecordsForEditing(){ function getCheckedRecords(){ + //getting list of records where checkbox is checked var checkboxes = document.getElementsByClassName('copy_over_checkbox_cell') var outputArray = [] for (var i = 0; i < checkboxes.length; i++) { @@ -147,6 +156,7 @@ function getCheckedRecords(){ } function formatTableSize(){ + //adjusting table formats var calendar = document.getElementById('calendar_container') var tableDiv = document.getElementById('list_container') var width = calendar.offsetWidth @@ -154,6 +164,7 @@ function formatTableSize(){ } function createDetailedHeaders(){ + //creating table with header row var table = document.createElement('table') let headerRow = document.createElement('tr') let columns = ['Date', 'Start time', 'End time', 'Activity type', 'Copy over'] diff --git a/hr_module/static/js/hr_module_base.js b/hr_module/static/js/hr_module_base.js index 21da12f..1a697b6 100644 --- a/hr_module/static/js/hr_module_base.js +++ b/hr_module/static/js/hr_module_base.js @@ -1,5 +1,6 @@ window.addEventListener('load', function(){ + //add class name to currently open sidebar link for css var sidebarItems = document.getElementById('sidebar').getElementsByTagName('a') var pathName = window.location.pathname for (var i = 0; i < sidebarItems.length; i++){ diff --git a/hr_module/static/js/hr_module_change_employee_data.js b/hr_module/static/js/hr_module_change_employee_data.js index aa54856..9e091f3 100644 --- a/hr_module/static/js/hr_module_change_employee_data.js +++ b/hr_module/static/js/hr_module_change_employee_data.js @@ -7,7 +7,7 @@ searchEmployeeButton.addEventListener('click', function(){ function fetchSearchEmployeeData() { var host = 'http://' + window.location.host; - var fetch_url = host + '/hr_module/change_employee_data_api' + var fetch_url = host + '/hr-module/change-employee-data-api' var username = document.getElementById('username_input').value fetch(fetch_url, diff --git a/hr_module/static/js/hr_module_create_schedule.js b/hr_module/static/js/hr_module_create_schedule.js index 15c1021..e8e8df2 100644 --- a/hr_module/static/js/hr_module_create_schedule.js +++ b/hr_module/static/js/hr_module_create_schedule.js @@ -1,7 +1,10 @@ import { csrftoken } from '../../../static/js/csrf_token.js' +//adding event listeners on load window.addEventListener('load', function (){ + + //filling datalist with choices for default searched field (Person) fetchSearchOptions() var filterType = document.getElementById('schedule_filter_category') @@ -15,9 +18,9 @@ window.addEventListener('load', function (){ }) function fetchSearchOptions() { + //function, loading list of choices for datalist var host = 'http://' + window.location.host; - var fetch_url = host + '/hr_module/search_api' - + var fetch_url = host + '/hr-module/search-api' var searched_field = document.getElementById('schedule_filter_category').value var searched_string = document.getElementById('searched_string').value @@ -41,6 +44,7 @@ function fetchSearchOptions() { function appendFoundFilterOptions(data){ + //appending html elements to datalist var parent = document.getElementById('schedule_filter_search'); parent.innerHTML = ''; for (var i = 0; i < data.length; i++) { @@ -59,8 +63,9 @@ function appendFoundFilterOptions(data){ } function fetchEmployees() { + //function to fetch list of found employees var host = 'http://' + window.location.host; - var fetch_url = host + '/hr_module/loademployees' + var fetch_url = host + '/hr-module/loademployees' var searched_field = document.getElementById('schedule_filter_category').value var searched_string = document.getElementById('searched_string').value @@ -85,6 +90,7 @@ function fetchEmployees() { } function appendFoundEmployees(data){ + //function to append found employees to the container var parentTable = document.getElementById('scheduling_list'); parent.innerHTML = ''; for (var i = 0; i < data.length; i++) { @@ -117,6 +123,7 @@ function appendFoundEmployees(data){ } function addDeleteButton(username){ + //adding delete button to every single row of found employees var cell = document.createElement('td') var submit = document.createElement('button') submit.innerHTML = 'Delete' @@ -127,6 +134,7 @@ function addDeleteButton(username){ } function addActivityType(){ + //adding dropdown with activity type var cell = document.createElement('td') var options = {'work': 'Work', 'vacation': 'Vacation', @@ -147,12 +155,14 @@ function addActivityType(){ } function addCell(row, innerhtml, index){ + //adding cell to a table var cell = row.insertCell(index); cell.innerHTML = innerhtml; return cell } function workingDays(parent, data){ + //creating cell with checkboxes checked for working days var days = ['mon', 'tue', 'wed', @@ -183,12 +193,14 @@ function workingDays(parent, data){ } function deleteRow(username){ + //function, deleting the row of the mployee console.log(username) var row = document.getElementById('employee_row_' + username) row.outerHTML = '' } function addDeleteEventListener(){ + //adding delete button event listener and calling deleteRow var buttons = document.getElementsByClassName('delete_button') for (let i = 0; i < buttons.length; i++){ buttons[i].addEventListener('click', function (){ @@ -198,13 +210,14 @@ function addDeleteEventListener(){ } function buildPlanJson(){ + //craete json to be submitted to the api to create new plan var listJsons = [] var employees = document.getElementsByClassName('employee_row') var lowerBoundary = document.getElementById('planning_lower_boundary').value var upperBoundary = document.getElementById('planning_upper_boundary').value for (var i = 0; i < employees.length; i++) { var planJson = {} - var row = employees[0] + var row = employees[i] var username = row.getAttribute('data-username') var startTime = row.getElementsByClassName('schedule_time_input')[0].value var activityType = row.getElementsByClassName('activity_type')[0].value @@ -228,8 +241,9 @@ function buildPlanJson(){ } function postPlanToDb(){ + //submitting the data to the database var host = 'http://' + window.location.host; - var fetch_url = host + '/hr_module/new_plan_api' + var fetch_url = host + '/hr-module/new-plan-api' var json = buildPlanJson() fetch(fetch_url, diff --git a/hr_module/static/js/hr_module_export.js b/hr_module/static/js/hr_module_export.js index c1cd130..1130145 100644 --- a/hr_module/static/js/hr_module_export.js +++ b/hr_module/static/js/hr_module_export.js @@ -2,21 +2,19 @@ import { csrftoken } from '../../../static/js/csrf_token.js' window.addEventListener('load', function (){ + //fetch search options for default searched category(Person) fetchSearchOptions() var filterType = document.getElementById('schedule_filter_category') filterType.addEventListener('change', fetchSearchOptions) - var fetchEmployeesButton = document.getElementById('load_employees'); - fetchEmployeesButton.addEventListener('click', fetchEmployees); - var submitToDb = document.getElementById('run_planning'); - submitToDb.addEventListener('click', postPlanToDb); }) function fetchSearchOptions() { + //function, loading list of choices for datalist var host = 'http://' + window.location.host; - var fetch_url = host + '/hr_module/search_api' + var fetch_url = host + '/hr-module/search-api' var searched_field = document.getElementById('schedule_filter_category').value var searched_string = document.getElementById('searched_string').value @@ -41,6 +39,7 @@ function fetchSearchOptions() { function appendFoundFilterOptions(data){ + //appending html elements to datalist var parent = document.getElementById('schedule_filter_search'); parent.innerHTML = ''; for (var i = 0; i < data.length; i++) { diff --git a/hr_module/templates/hr_module_base.html b/hr_module/templates/hr_module_base.html index 1a1e4ba..234a700 100644 --- a/hr_module/templates/hr_module_base.html +++ b/hr_module/templates/hr_module_base.html @@ -39,7 +39,7 @@ -