File tree 5 files changed +19
-3
lines changed
5 files changed +19
-3
lines changed Original file line number Diff line number Diff line change @@ -4,4 +4,6 @@ pg96_data/
4
4
* .log
5
5
mongo /
6
6
* .sqlite
7
- upload /
7
+ upload /
8
+ wr_prd.sqlite
9
+ * .pyc
Original file line number Diff line number Diff line change 7
7
from flask_login import LoginManager
8
8
from flask_sqlalchemy import SQLAlchemy
9
9
from .json_encoder import JSONEncoder
10
- from utils import get_last_week_content
10
+ from utils import get_last_week_content , get_week_days
11
11
12
12
13
13
bootstrap = Bootstrap ()
@@ -63,4 +63,5 @@ def create_app(config_file):
63
63
app .json_encoder = JSONEncoder
64
64
65
65
app .add_template_filter (get_last_week_content , 'get_last_week_content' )
66
+ app .add_template_filter (get_week_days , 'get_week_days' )
66
67
return app
Original file line number Diff line number Diff line change 14
14
< a rel ="tag " class ="post-tag "> {{_('Department')}}:{{ report.department.name }}</ a >
15
15
< a rel ="tag " class ="post-tag "> {{_('Week Count')}}:{{ report.week_count }}</ a >
16
16
< a rel ="tag " class ="post-tag "> {{_('Year')}}:{{ report.year }}</ a >
17
+ < a rel ="tag " class ="post-tag "> {{_('Start')}}:{{ report.year | get_week_days(report.week_count,0) }}</ a >
18
+ < a rel ="tag " class ="post-tag "> {{_('End')}}:{{ report.year | get_week_days(report.week_count,1) }}</ a >
17
19
{{report.content|safe}}
18
20
19
21
{% if report.is_of_current_week %}
Original file line number Diff line number Diff line change 26
26
< a rel ="tag " class ="post-tag "> {{_('Department')}}:{{ report.department.name }}</ a >
27
27
< a rel ="tag " class ="post-tag "> {{_('Week Count')}}:{{ report.week_count }}</ a >
28
28
< a rel ="tag " class ="post-tag "> {{_('Year')}}:{{ report.year }}</ a >
29
+ < a rel ="tag " class ="post-tag "> {{_('Start')}}:{{ report.year | get_week_days(report.week_count,0) }}</ a >
30
+ < a rel ="tag " class ="post-tag "> {{_('End')}}:{{ report.year | get_week_days(report.week_count,1) }}</ a >
29
31
< table class ="table table-striped table-bordered table-hover model-list ">
30
32
< thead >
31
33
< tr >
Original file line number Diff line number Diff line change @@ -72,4 +72,13 @@ def clean_html(html):
72
72
cleaned = re .sub (r" " , " " , cleaned )
73
73
cleaned = re .sub (r" " , " " , cleaned )
74
74
cleaned = re .sub (r" " , " " , cleaned )
75
- return cleaned .strip ()
75
+ return cleaned .strip ()
76
+
77
+ def get_week_days (year , week , index ):
78
+ d = datetime .date (year , 1 , 1 )
79
+ if (d .weekday () > 3 ):
80
+ d = d + datetime .timedelta (7 - d .weekday ())
81
+ else :
82
+ d = d - datetime .timedelta (d .weekday ())
83
+ dlt = datetime .timedelta (days = (week - 1 ) * 7 )
84
+ return (d + dlt , d + dlt + datetime .timedelta (days = 6 ))[index ]
You can’t perform that action at this time.
0 commit comments