chnaged logic for multi pdf upload in upload daily task report
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 13s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 13s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 19s
Laravel Pint / pint (pull_request) Successful in 4m4s
Laravel Larastan / larastan (pull_request) Failing after 5m9s
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 13s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 13s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 19s
Laravel Pint / pint (pull_request) Successful in 4m4s
Laravel Larastan / larastan (pull_request) Failing after 5m9s
This commit is contained in:
@@ -90,7 +90,8 @@ class SendDailyTaskReport extends Command
|
|||||||
$rows[] = [
|
$rows[] = [
|
||||||
'sno' => $sno++,
|
'sno' => $sno++,
|
||||||
'name' => $this->extractNameFromFilename($filename),
|
'name' => $this->extractNameFromFilename($filename),
|
||||||
'project-name' => $this->extractProjectName($text),
|
// 'project-name' => $this->extractProjectName($text),
|
||||||
|
'project-name' => $pdf ? $this->extractProjectName($pdf) : 'Unknown project',
|
||||||
'task' => $this->extractTaskTitle($text),
|
'task' => $this->extractTaskTitle($text),
|
||||||
'status' => $this->extractStatus($text),
|
'status' => $this->extractStatus($text),
|
||||||
'completed' => $this->extractPercentComplete($text),
|
'completed' => $this->extractPercentComplete($text),
|
||||||
@@ -214,12 +215,29 @@ class SendDailyTaskReport extends Command
|
|||||||
return '0%';
|
return '0%';
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function extractProjectName(string $text): string
|
// protected function extractProjectName(string $text): string
|
||||||
{
|
// {
|
||||||
$normalized = str_replace("\xC2\xA0", ' ', $text);
|
// $normalized = str_replace("\xC2\xA0", ' ', $text);
|
||||||
|
|
||||||
// Footer pattern: <page#><date>\t<Project Name> at the very end of the PDF text
|
// // Footer pattern: <page#><date>\t<Project Name> at the very end of the PDF text
|
||||||
if (preg_match('/\d{1,2}-\d{2}-\d{4}\s*\t\s*(.+?)\s*$/s', $normalized, $matches)) {
|
// if (preg_match('/\d{1,2}-\d{2}-\d{4}\s*\t\s*(.+?)\s*$/s', $normalized, $matches)) {
|
||||||
|
// return trim($matches[1]);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// return 'Unknown project';
|
||||||
|
// }
|
||||||
|
|
||||||
|
protected function extractProjectName($pdf): string
|
||||||
|
{
|
||||||
|
$pages = $pdf->getPages();
|
||||||
|
|
||||||
|
if (empty($pages)) {
|
||||||
|
return 'Unknown project';
|
||||||
|
}
|
||||||
|
|
||||||
|
$firstPageText = str_replace("\xC2\xA0", ' ', $pages[0]->getText());
|
||||||
|
|
||||||
|
if (preg_match('/\d{1,2}-\d{2}-\d{4}\s*\t\s*(.+?)\s*$/s', $firstPageText, $matches)) {
|
||||||
return trim($matches[1]);
|
return trim($matches[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user