Skip to content

Commit

Permalink
[BUGFIX] Fix the sorting in the daily registration digest (#23)
Browse files Browse the repository at this point in the history
  • Loading branch information
oliverklee authored Jan 30, 2018
1 parent a91b77a commit 416bb00
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 35 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ This project adheres to [Semantic Versioning](https://semver.org/).
### Removed

### Fixed

## 1.4.1

### Fixed
- fix the sorting in the daily registration digest (#23)
- require mkforms >= 3.0.14 (#22)

## 1.4.0
Expand All @@ -25,7 +30,6 @@ This project adheres to [Semantic Versioning](https://semver.org/).

### Changed
- disable the legacy BE module in TYPO3 8LTS (#15)
- event status email should list upcoming events on top (#14)
- require mkforms >= 3.0.0 (#6)
- require static_info_tables >= 6.3.7 (#4)
- move the extension to GitHub
Expand Down
7 changes: 3 additions & 4 deletions Classes/Mapper/Event.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,9 @@ public function findNextUpcoming()
*/
public function findForAutomaticStatusChange()
{
$whereClause = 'cancelled = ' . Tx_Seminars_Model_Event::STATUS_PLANNED .
' AND automatic_confirmation_cancelation = 1';
$whereClause = 'cancelled = ' . Tx_Seminars_Model_Event::STATUS_PLANNED . ' AND automatic_confirmation_cancelation = 1';

return $this->findByWhereClause($whereClause, 'begin_date ASC');
return $this->findByWhereClause($whereClause);
}

/**
Expand All @@ -176,6 +175,6 @@ public function findForRegistrationDigestEmail()
' AND tx_seminars_attendances.crdate > tx_seminars_seminars.date_of_last_registration_digest' .
')';

return $this->findByWhereClause($whereClause);
return $this->findByWhereClause($whereClause, 'begin_date ASC');
}
}
2 changes: 1 addition & 1 deletion Documentation/Settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ conf.py:
copyright: 2018
project: Seminar Manager
version: 1.4
release: 1.4.0
release: 1.4.1
latex_documents:
- - Index
- seminars.tex
Expand Down
66 changes: 38 additions & 28 deletions Tests/Unit/Mapper/EventTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
/**
* Test case.
*
*
* @author Niels Pardon <[email protected]>
* @author Oliver Klee <[email protected]>
*/
Expand Down Expand Up @@ -1077,33 +1076,6 @@ public function findForAutomaticStatusChangeNotFindsPlannedEventWithoutAutomatic
self::assertTrue($result->isEmpty());
}

/**
* @test
*/
public function findForAutomaticStatusChangeSortsResultsByStartDateInAscendingOrder()
{
$laterUid = $this->testingFramework->createRecord(
'tx_seminars_seminars',
[
'begin_date' => mktime(10, 0, 0, 1, 20, 2018),
'cancelled' => Tx_Seminars_Model_Event::STATUS_PLANNED,
'automatic_confirmation_cancelation' => 1
]
);
$earlierUid = $this->testingFramework->createRecord(
'tx_seminars_seminars',
[
'begin_date' => mktime(10, 0, 0, 1, 15, 2018),
'cancelled' => Tx_Seminars_Model_Event::STATUS_PLANNED,
'automatic_confirmation_cancelation' => 1
]
);

$result = $this->fixture->findForAutomaticStatusChange();

self::assertSame($earlierUid . ',' . $laterUid, $result->getUids());
}

/*
* Tests concerning findForRegistrationDigestEmail
*/
Expand Down Expand Up @@ -1162,6 +1134,44 @@ public function findForRegistrationDigestEmailFindsEventWithRegistrationAndWitho
self::assertSame($eventUid, $result->first()->getUid());
}

/**
* @test
*/
public function findForRegistrationDigestEmailSortsEventsByBeginDateInAscendingOrder()
{
$laterEventUid = $this->testingFramework->createRecord(
'tx_seminars_seminars',
[
'object_type' => Tx_Seminars_Model_Event::TYPE_COMPLETE,
'begin_date' => mktime(10, 0, 0, 1, 20, 2018),
'date_of_last_registration_digest' => 0,
'registrations' => 1,
]
);
$this->testingFramework->createRecord(
'tx_seminars_attendances',
['seminar' => $laterEventUid, 'crdate' => 1]
);
$earlierEventUid = $this->testingFramework->createRecord(
'tx_seminars_seminars',
[
'object_type' => Tx_Seminars_Model_Event::TYPE_COMPLETE,
'begin_date' => mktime(10, 0, 0, 1, 15, 2018),
'date_of_last_registration_digest' => 0,
'registrations' => 1,
]
);
$this->testingFramework->createRecord(
'tx_seminars_attendances',
['seminar' => $earlierEventUid, 'crdate' => 1]
);

$result = $this->fixture->findForRegistrationDigestEmail();

self::assertSame(2, $result->count());
self::assertSame($earlierEventUid . ',' . $laterEventUid, $result->getUids());
}

/**
* @test
*/
Expand Down
2 changes: 1 addition & 1 deletion ext_emconf.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
'author_company' => 'oliverklee.de',
'CGLcompliance' => '',
'CGLcompliance_note' => '',
'version' => '1.4.0',
'version' => '1.4.1',
'_md5_values_when_last_written' => '',
'constraints' => [
'depends' => [
Expand Down

0 comments on commit 416bb00

Please sign in to comment.