@@ -11,6 +11,7 @@ function allIncluded(){
11
11
var nextWeekArray = [ ] ;
12
12
var reviewedPrsArray = [ ] ;
13
13
var githubIssuesData = null ;
14
+ var lastWeekContribution = false ;
14
15
var githubPrsReviewData = null ;
15
16
var githubUserData = null ;
16
17
var githubPrsReviewDataProccessed = { } ;
@@ -27,21 +28,26 @@ var issue_opened_button="<div style=\"vertical-align:middle;display: inline-bloc
27
28
28
29
var linkStyle = "" ;
29
30
function getChromeData ( ) {
30
- chrome . storage . local . get ( [ "githubUsername" , "enableToggle" , "startingDate" , "endingDate" , "showOpenLabel" , "showClosedLabel" , "userReason" , "gsoc" ] , function ( items ) {
31
+ chrome . storage . local . get ( [ "githubUsername" , "enableToggle" , "startingDate" , "endingDate" , "showOpenLabel" , "showClosedLabel" , "lastWeekContribution" , "userReason" , "gsoc" ] , function ( items ) {
32
+ if ( items . lastWeekContribution ) {
33
+ lastWeekContribution = true ;
34
+ handleLastWeekContributionChange ( ) ;
35
+ }
31
36
if ( ! items . enableToggle ) {
32
37
enableToggle = items . enableToggle ;
33
38
34
39
}
35
- if ( items . endingDate ) {
40
+ if ( items . endingDate && ! lastWeekContribution ) {
36
41
endingDate = items . endingDate ;
37
42
}
38
- if ( items . startingDate ) {
43
+ if ( items . startingDate && ! lastWeekContribution ) {
39
44
startingDate = items . startingDate ;
40
45
}
41
46
if ( items . githubUsername ) {
42
47
githubUsername = items . githubUsername ;
43
48
fetchGithubData ( ) ;
44
49
}
50
+
45
51
if ( ! items . showOpenLabel ) {
46
52
showOpenLabel = false ;
47
53
pr_unmerged_button = "" ;
@@ -67,6 +73,30 @@ function getChromeData(){
67
73
} ) ;
68
74
}
69
75
getChromeData ( ) ;
76
+
77
+ function handleLastWeekContributionChange ( ) {
78
+ endingDate = getToday ( ) ;
79
+ startingDate = getLastWeek ( ) ;
80
+ }
81
+ function getLastWeek ( ) {
82
+ var today = new Date ( ) ;
83
+ var noDays_to_goback = gsoc == 0 ?7 :1 ;
84
+ var lastWeek = new Date ( today . getFullYear ( ) , today . getMonth ( ) , today . getDate ( ) - noDays_to_goback ) ;
85
+ var lastWeekMonth = lastWeek . getMonth ( ) + 1 ;
86
+ var lastWeekDay = lastWeek . getDate ( ) ;
87
+ var lastWeekYear = lastWeek . getFullYear ( ) ;
88
+ var lastWeekDisplayPadded = ( "0000" + lastWeekYear . toString ( ) ) . slice ( - 4 ) + "-" + ( "00" + lastWeekMonth . toString ( ) ) . slice ( - 2 ) + "-" + ( "00" + lastWeekDay . toString ( ) ) . slice ( - 2 ) ;
89
+ return lastWeekDisplayPadded ;
90
+ }
91
+ function getToday ( ) {
92
+ var today = new Date ( ) ;
93
+ var Week = new Date ( today . getFullYear ( ) , today . getMonth ( ) , today . getDate ( ) ) ;
94
+ var WeekMonth = Week . getMonth ( ) + 1 ;
95
+ var WeekDay = Week . getDate ( ) ;
96
+ var WeekYear = Week . getFullYear ( ) ;
97
+ var WeekDisplayPadded = ( "0000" + WeekYear . toString ( ) ) . slice ( - 4 ) + "-" + ( "00" + WeekMonth . toString ( ) ) . slice ( - 2 ) + "-" + ( "00" + WeekDay . toString ( ) ) . slice ( - 2 ) ;
98
+ return WeekDisplayPadded ;
99
+ }
70
100
// fetch github data
71
101
function fetchGithubData ( ) {
72
102
console . log ( startingDate ) ;
@@ -127,9 +157,6 @@ function writeScrumBody(){
127
157
var nextWeekUl = "<ul>" ;
128
158
for ( i = 0 ; i < nextWeekArray . length ; i ++ )
129
159
nextWeekUl += nextWeekArray [ i ] ;
130
- for ( i in githubPrsReviewDataProccessed ) {
131
- nextWeekUl += "<li><i>(" + i + ")</i> - Review more PRs </li>" ;
132
- }
133
160
nextWeekUl += "</ul>" ;
134
161
var weekOrDay = gsoc == 1 ?"yesterday" :"last week" ;
135
162
var weekOrDay2 = gsoc == 1 ?"today" :"this week" ;
0 commit comments