• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

ericfortmeyer / activity-log / 20420404465

22 Dec 2025 03:01AM UTC coverage: 51.874% (-1.6%) from 53.429%
20420404465

push

github

web-flow
fix: add tenant id to all post requests (#60)

Signed-off-by: Eric Fortmeyer <e.fortmeyer01@gmail.com>

17 of 49 new or added lines in 10 files covered. (34.69%)

2 existing lines in 2 files now uncovered.

346 of 667 relevant lines covered (51.87%)

1.62 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/Http/RequestProcessors/SaveRemarksForMonth.php
1
<?php
2

3
namespace EricFortmeyer\ActivityLog\Http\RequestProcessors;
4

5
use Phpolar\{
6
    Model\Model,
7
    PurePhp\HtmlSafeContext,
8
    PurePhp\TemplateEngine,
9
    Storage\NotFound
10
};
11
use Phpolar\Phpolar\Auth\Authorize;
12
use EricFortmeyer\ActivityLog\{
13
    RemarksForMonth,
14
    MonthFilters,
15
    CreditHours,
16
    TimeEntry
17
};
18
use EricFortmeyer\ActivityLog\Services\{
19
    RemarksForMonthService,
20
    CreditHoursService,
21
    TimeEntryService
22
};
23
use EricFortmeyer\ActivityLog\UserInterface\Contexts\TimeEntriesContext;
24
use EricFortmeyer\ActivityLog\Utils\Hasher;
25

26
final class SaveRemarksForMonth extends AbstractTenantBasedRequestProcessor
27
{
28
    public function __construct(
29
        private readonly RemarksForMonthService $remarksService,
30
        private readonly CreditHoursService $creditHoursService,
31
        private readonly TimeEntryService $timeEntryService,
32
        private readonly TemplateEngine $templateEngine,
33
        readonly Hasher $hasher,
34
    ) {
35
        parent::__construct($hasher);
×
36
    }
37

38
    #[Authorize]
39
    public function process(
40
        #[Model] RemarksForMonth $remarks = new RemarksForMonth(),
41
        #[Model] MonthFilters $monthFilters = new MonthFilters()
42
    ): string {
43
        if ($remarks->isValid() === true) {
×
44
            $this->remarksService->save($remarks, $this->getTenantId());
×
45
        }
46
        $remarks->isPosted();
×
47

48
        $creditHours = $this->creditHoursService->get(
×
49
            CreditHours::getIdFromMonth(
×
50
                year: $remarks->year,
×
51
                month: $remarks->month,
×
52
                tenantId: $this->getTenantId(),
×
53
            ),
×
54
        );
×
55

56
        $timeEntries = $this->timeEntryService->getAllByMonth(
×
57
            month: $remarks->month,
×
58
            year: $remarks->year,
×
59
            tenantId: $this->getTenantId(),
×
60
        );
×
61
        $currentEntry = new TimeEntry();
×
NEW
62
        TimeEntry::setUninitializedValues(
×
NEW
63
            $currentEntry,
×
NEW
64
            $remarks->month,
×
NEW
65
            $remarks->year,
×
NEW
66
        );
×
67
        return (string) $this->templateEngine->apply(
×
68
            "index",
×
69
            new HtmlSafeContext(
×
70
                $creditHours instanceof NotFound
×
71
                    ? new TimeEntriesContext(
×
72
                        timeEntries: $timeEntries,
×
NEW
73
                        tenantId: $this->getTenantId(),
×
74
                        currentEntry: $currentEntry,
×
75
                        filters: $monthFilters,
×
76
                        remarks: $remarks,
×
77
                        user: $this->user,
×
78
                    )
×
79
                    : new TimeEntriesContext(
×
80
                        timeEntries: $timeEntries,
×
NEW
81
                        tenantId: $this->getTenantId(),
×
82
                        currentEntry: $currentEntry,
×
83
                        filters: $monthFilters,
×
84
                        remarks: $remarks,
×
85
                        creditHours: $creditHours,
×
86
                        user: $this->user,
×
87
                    )
×
88
            )
×
89
        );
×
90
    }
91
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc