Skip to content

Commit

Permalink
Merge pull request #678 from Leantime/fixes
Browse files Browse the repository at this point in the history
fix ticket count issue #656
  • Loading branch information
marcelfolaron committed Apr 13, 2022
2 parents 46ff3b2 + b057064 commit 254094b
Show file tree
Hide file tree
Showing 9 changed files with 57 additions and 33 deletions.
41 changes: 24 additions & 17 deletions .github/workflows/main.yml
@@ -1,26 +1,33 @@
name: Psalm Static analysis
name: Psalm

on: [push, pull_request]
on:
push:
paths:
- '**.php'
- 'psalm.xml.dist'

jobs:
psalm:
name: Psalm
name: psalm
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- uses: actions/checkout@v2

- name: Psalm
uses: docker://vimeo/psalm-github-actions
continue-on-error: true
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
security_analysis: true
report_file: results.sarif
composer_require_dev: true
composer_ignore_platform_reqs: false

- name: Upload Security Analysis results to GitHub
uses: github/codeql-action/upload-sarif@v1
php-version: '7.4'
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, ext-ldap
coverage: none

- name: Cache composer dependencies
uses: actions/cache@v2
with:
sarif_file: results.sarif

path: vendor
key: composer-${{ hashFiles('composer.lock') }}

- name: Run composer install
run: composer install -n --prefer-dist

- name: Run psalm
run: ./vendor/bin/psalm --output-format=github
1 change: 1 addition & 0 deletions resources/language/en-GB.ini
Expand Up @@ -220,6 +220,7 @@ notification.client_exists_already = "Client exists already"
notification.client_has_todos = "Client has to-dos & projects assigned"
notification.client_deleted = "Client deleted successfully"
notification.event_created_successfully = "Event created successfully"
notification.event_edited_successfully = "Event edited successfully"
notification.event_removed_successfully = "Event removed successfully"
notification.could_not_delete_event = "Could not delete event"
notification.user_created = "New user created successfully"
Expand Down
1 change: 1 addition & 0 deletions resources/language/en-US.ini
Expand Up @@ -225,6 +225,7 @@ notification.client_exists_already = "Client exists already"
notification.client_has_todos = "Client has to-dos & projects assigned"
notification.client_deleted = "Client deleted successfully"
notification.event_created_successfully = "Event created successfully"
notification.event_edited_successfully = "Event edited successfully"
notification.event_removed_successfully = "Event removed successfully"
notification.could_not_delete_event = "Could not delete event"
notification.user_created = "New user created successfully"
Expand Down
2 changes: 1 addition & 1 deletion src/domain/calendar/templates/showMyCalendar.tpl.php
Expand Up @@ -49,7 +49,7 @@
$calendar['dateTo']['h'].','.
$calendar['dateTo']['i'] ?>),
<?php endif; ?>
<?php if ((isset($calendar['allDay']) && $calendar['allDay'] == 1)) : ?>
<?php if ((isset($calendar['allDay']) && $calendar['allDay'] == TRUE)) : ?>
allDay: true,
<?php else: ?>
allDay: false,
Expand Down
4 changes: 2 additions & 2 deletions src/domain/ldap/services/class.ldap.php
Expand Up @@ -110,8 +110,8 @@ public function connect() {
public function bind($username='', $password=''){

if($username != '' && $password != ''){
$usernameDN = $this->ldapKeys->username."=".$this->bindUser.",".$this->ldapDn;
$passwordBind='';
$usernameDN = $this->ldapKeys->username."=".$username.",".$this->ldapDn;
$passwordBind=$password;
}else{
$usernameDN = $this->ldapKeys->username."=".$this->bindUser.",".$this->ldapDn;
$passwordBind = $this->bindPassword;
Expand Down
6 changes: 3 additions & 3 deletions src/domain/projects/repositories/class.projects.php
Expand Up @@ -118,7 +118,7 @@ public function getUserProjects($userId, $status = "all", $clientId = "")
project.state,
project.hourBudget,
project.dollarBudget,
COUNT(ticket.projectId) AS numberOfTickets,
SUM(case when ticket.type <> 'milestone' AND ticket.type <> 'subtask' then 1 else 0 end) as numberOfTickets,
client.name AS clientName,
client.id AS clientId
FROM zp_relationuserproject AS relation
Expand Down Expand Up @@ -166,7 +166,7 @@ public function getClientProjects($clientId)
project.hourBudget,
project.dollarBudget,
project.state,
COUNT(ticket.projectId) AS numberOfTickets,
SUM(case when ticket.type <> 'milestone' AND ticket.type <> 'subtask' then 1 else 0 end) as numberOfTickets,
client.name AS clientName,
client.id AS clientId
FROM zp_projects as project
Expand Down Expand Up @@ -234,7 +234,7 @@ public function getProject($id)
zp_projects.hourBudget,
zp_projects.dollarBudget,
zp_clients.name AS clientName,
COUNT(zp_tickets.id) AS numberOfTickets
SUM(case when zp_tickets.type <> 'milestone' AND zp_tickets.type <> 'subtask' then 1 else 0 end) as numberOfTickets
FROM zp_projects
LEFT JOIN zp_tickets ON zp_projects.id = zp_tickets.projectId
LEFT JOIN zp_clients ON zp_projects.clientId = zp_clients.id
Expand Down
31 changes: 23 additions & 8 deletions src/domain/sprints/services/class.sprints.php
Expand Up @@ -174,21 +174,36 @@ public function getSprintBurndown($sprint)
$plannedEffortStart = 0;
}

$dateStart = new DateTime($sprint->startDate);
$dateEnd = new DateTime($sprint->endDate);
//The sprint object can come from the repository or the service.
//Dates get formatted in the service and could not be parsed
//Checking if we have an iso date or not
if(strlen($sprint->startDate) > 11){
//DB dateformat
$dateStart = new DateTime($sprint->startDate);
$dateEnd = new DateTime($sprint->endDate);
$period = new DatePeriod(
new DateTime($sprint->startDate),
new DateInterval('P1D'),
new DateTime($sprint->endDate)
);
}else{
//language formatted
$dateStart = new DateTime($this->language->getISODateString($sprint->startDate));
$dateEnd = new DateTime($this->language->getISODateString($sprint->endDate));
$period = new DatePeriod(
new DateTime($this->language->getISODateString($sprint->startDate)),
new DateInterval('P1D'),
new DateTime($this->language->getISODateString($sprint->endDate))
);
}

$sprintLength = $dateEnd->diff($dateStart)->format("%a");
$sprintLength++; //Diff is 1 day less than actual sprint days (eg even if a sprint starts and ends today it should still be a 1 day sprint, but the diff would be 0)

$dailyHoursPlanned = $plannedHoursStart / $sprintLength;
$dailyNumPlanned = $plannedNumStart / $sprintLength;
$dailyEffortPlanned = $plannedEffortStart / $sprintLength;

$period = new DatePeriod(
new DateTime($sprint->startDate),
new DateInterval('P1D'),
new DateTime($sprint->endDate)
);

$burnDown = [];
$i = 0;
foreach ($period as $key => $value) {
Expand Down
2 changes: 1 addition & 1 deletion src/domain/tickets/templates/delTicket.tpl.php
Expand Up @@ -8,7 +8,7 @@
<div class="pageicon"><span class="<?php echo $this->getModulePicture() ?>"></span></div>
<div class="pagetitle">
<h5><?php echo $_SESSION['currentProjectClient']." // ". $_SESSION['currentProjectName']; ?></h5>
<h1><?php echo $this->__('headline.delete_ticket'); ?><?= $this->e($ticket->headline);?></h1>
<h1><?php echo $this->__('headline.delete_ticket'); ?>: <?= $this->e($ticket->headline);?></h1>
</div>
</div><!--pageheader-->

Expand Down
2 changes: 1 addition & 1 deletion src/domain/users/repositories/class.users.php
Expand Up @@ -211,7 +211,7 @@ public function getAllClientUsers($clientId)
twoFAEnabled,
zp_clients.name AS clientName
FROM `zp_user`
LEFT JOIN zp_clients ON zp_clients.id = zp_user.id
LEFT JOIN zp_clients ON zp_clients.id = zp_user.clientId
WHERE clientId = :clientId
ORDER BY lastname";

Expand Down

0 comments on commit 254094b

Please sign in to comment.