improve
This commit is contained in:
parent
c4f527a31e
commit
3bf577d17a
57
repeat.php
57
repeat.php
@ -32,16 +32,65 @@ foreach($terms as $k=>$vs){
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
//define the function to process each issue
|
//define the function to process each issue
|
||||||
|
|
||||||
$daily=function($issue){
|
$daily=function($issue){
|
||||||
//$hours_ago=(time()-strtotime($issue->closed_at))/60/60;
|
$day_updated=date('d/m/Y',strtotime($issue->updated_at));
|
||||||
$day_closed=date('z',strtotime($issue->closed_at));
|
$day_closed=date('d/m/Y',strtotime($issue->closed_at));
|
||||||
$day_today=date('z');
|
$day_today=date('d/m/Y');
|
||||||
echo $issue->title." ".$issue->closed_at." ($day_closed, $day_today) \n";
|
echo "Daily: ". $issue->title." ".$issue->closed_at." ($day_closed, $day_today) \n";
|
||||||
if($day_closed!=$day_today){
|
if($day_closed!=$day_today){
|
||||||
|
if($issue->state=="closed"){
|
||||||
|
$issue->state='open';
|
||||||
|
$issue->save();
|
||||||
|
}else{
|
||||||
|
if($day_updated!=$day_today){
|
||||||
|
$issue->addComment("NAG!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
$monthly=function($issue) use ($terms){
|
||||||
|
$month_closed=date('m/Y',strtotime($issue->closed_at));
|
||||||
|
$month_today=date('m/Y');
|
||||||
|
echo "Monthly: ".$issue->title." ".$issue->closed_at." ($month_closed, $month_today) \n";
|
||||||
|
//print_r($issue->labels);
|
||||||
|
//print_r(getRepeatTerms($issue,$terms));
|
||||||
|
//die();
|
||||||
|
if($month_closed!=$month_today){
|
||||||
$issue->state='open';
|
$issue->state='open';
|
||||||
$issue->save();
|
$issue->save();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
$tmp=function($issue){
|
||||||
|
//$hours_ago=(time()-strtotime($issue->closed_at))/60/60;
|
||||||
|
};
|
||||||
|
|
||||||
|
function getRepeatTerms($issue,$terms){
|
||||||
|
$labels=[];
|
||||||
|
$found=[];
|
||||||
|
foreach($issue->labels as $label){
|
||||||
|
$labels[]=$label->name;
|
||||||
|
}
|
||||||
|
print_r($labels);
|
||||||
|
foreach($terms as $name=>$values){
|
||||||
|
foreach($values as $value){
|
||||||
|
if( in_array("$value/repeat",$labels) ){
|
||||||
|
$found[$name][]=$value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $found;
|
||||||
|
}
|
||||||
|
|
||||||
//loop through issues and call the callback
|
//loop through issues and call the callback
|
||||||
|
$day_name=strtolower(date('l'));
|
||||||
|
$month_name=strtolower(date('F'));
|
||||||
|
|
||||||
|
//$repo->forIssues($daily,['state'=>'open','labels'=>'daily/repeat']);
|
||||||
|
//die();
|
||||||
$repo->forIssues($daily,['state'=>'closed','labels'=>'daily/repeat']);
|
$repo->forIssues($daily,['state'=>'closed','labels'=>'daily/repeat']);
|
||||||
|
$repo->forIssues($daily,['state'=>'closed','labels'=>$day_name.'/repeat']);
|
||||||
|
$repo->forIssues($monthly,['state'=>'closed','labels'=>'monthly/repeat']);
|
||||||
|
$repo->forIssues($monthly,['state'=>'closed','labels'=>$month_name.'/repeat']);
|
||||||
|
Loading…
Reference in New Issue
Block a user