Compare commits

...

3 Commits

Author SHA1 Message Date
c3fce4783a Release v2.24.1 2024-10-02 10:17:51 +02:00
be8901a5c4 Fix referrer scope date comparison in aggregator
Correct the date comparison logic to use openingDate instead of closingDate when evaluating user history end dates. This ensures accurate grouping by referrer in the accompanying course aggregators. Added a changelog entry for Issue #309.
2024-09-16 15:52:48 +02:00
6f28d154c8 Fix referrers display to show only current referrers.
Updated the view to loop through current referrers in the accompanying period. Added new method `getReferrersHistoryCurrent` to the entity to filter and return only active referrers, ensuring correct display in the UI. Also included documentation for better code clarity.
2024-09-16 15:25:25 +02:00
5 changed files with 33 additions and 4 deletions

5
.changes/v2.24.1.md Normal file
View File

@@ -0,0 +1,5 @@
## v2.24.1 - 2024-10-02
### Fixed
* ([#308](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/308)) Show only the current referrer in the page "show" for an accompanying period workf
* ([#309](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/309)) Correctly compute the grouping by referrer aggregator

View File

@@ -6,6 +6,12 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html),
and is generated by [Changie](https://github.com/miniscruff/changie).
## v2.24.1 - 2024-10-02
### Fixed
* ([#308](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/308)) Show only the current referrer in the page "show" for an accompanying period workf
* ([#309](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/309)) Correctly compute the grouping by referrer aggregator
## v2.24.0 - 2024-09-11
### Feature
* ([#306](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/306)) When a document is converted or downloaded in the browser, this document is removed from the browser memory after 45s. Future click on the button re-download the document.

View File

@@ -394,7 +394,13 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues
}
/**
* @return ReadableCollection<int, User>
* Retrieves a collection of current referrers.
*
* This method filters the referrer history to get only those entries
* where the end date is null, maps them to their associated users,
* and returns them as a new ReadableCollection.
*
* @return ReadableCollection<int, User> collection of active referrers
*
* @Serializer\Groups({"accompanying_period_work:edit"})
*/
@@ -408,6 +414,18 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues
return new ArrayCollection(array_values($users));
}
/**
* @return ReadableCollection<int, AccompanyingPeriodWorkReferrerHistory>
*/
public function getReferrersHistoryCurrent(): ReadableCollection
{
return new ArrayCollection(
$this->getReferrersHistory()
->filter(fn (AccompanyingPeriodWorkReferrerHistory $h) => null === $h->getEndDate())
->getValues()
);
}
/**
* @return Collection<int, AccompanyingPeriodWorkReferrerHistory>
*/

View File

@@ -56,7 +56,7 @@ readonly class ReferrerScopeAggregator implements AggregatorInterface, DataTrans
$qb->expr()->gte('COALESCE(acp.closingDate, CURRENT_TIMESTAMP())', "{$p}_userHistory.startDate"),
$qb->expr()->orX(
$qb->expr()->isNull("{$p}_userHistory.endDate"),
$qb->expr()->lt('COALESCE(acp.closingDate, CURRENT_TIMESTAMP())', "{$p}_userHistory.endDate")
$qb->expr()->lt('COALESCE(acp.openingDate, CURRENT_TIMESTAMP())', "{$p}_userHistory.endDate")
)
),
$qb->expr()->andX(

View File

@@ -83,10 +83,10 @@
</div>
<div class="wl-col list">
{%- if w.referrers|length > 0 -%}
{% for r in w.referrersHistory %}
{% for r in w.referrersHistoryCurrent %}
<span class="wl-item">
<span class="badge-user">{{ r.user|chill_entity_render_box({'at_date': r.startDate}) }}</span>
{% if not loop.last %}, {% endif %}
{%- if not loop.last %}, {% endif %}
</span>
{% endfor %}
{% else %}