Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
kohinos-tav
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
6
Merge Requests
6
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
agplv3
kohinos-tav
Commits
99a14915
Commit
99a14915
authored
Jun 10, 2022
by
Julien Jorry
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Solidoume : delete local tests
parent
4792a5a5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
62 deletions
+6
-62
SolidoumeCommand.php
src/Command/SolidoumeCommand.php
+6
-62
No files found.
src/Command/SolidoumeCommand.php
View file @
99a14915
...
...
@@ -111,12 +111,8 @@ class SolidoumeCommand extends Command
private
function
executeReminders
()
{
$this
->
io
->
title
(
'START : Rappel par email'
);
if
(
!
$this
->
isTest
)
{
$items
=
$this
->
em
->
getRepository
(
SolidoumeItem
::
class
)
->
findBy
([
'enabled'
=>
true
]);
}
else
{
$items
=
$this
->
getItemsForTest
();
}
$items
=
$this
->
em
->
getRepository
(
SolidoumeItem
::
class
)
->
findBy
([
'enabled'
=>
true
]);
foreach
(
$items
as
$item
)
{
if
(
$this
->
hasToExecuteReminders
(
$item
))
{
$amount
=
$item
->
getAmount
();
...
...
@@ -173,11 +169,8 @@ class SolidoumeCommand extends Command
$this
->
io
->
title
(
'START : prélèvement du jour'
);
$nowDay
=
(
new
\DateTime
(
'now'
,
new
\DateTimeZone
(
'UTC'
)))
->
format
(
'd'
);
$nowMonth
=
intval
((
new
\DateTime
(
'now'
,
new
\DateTimeZone
(
'UTC'
)))
->
format
(
'Ym'
));
if
(
!
$this
->
isTest
)
{
$items
=
$this
->
em
->
getRepository
(
SolidoumeItem
::
class
)
->
findBy
([
'enabled'
=>
true
,
'paiementDate'
=>
$nowDay
]);
}
else
{
$items
=
$this
->
getItemsForTest
();
}
$items
=
$this
->
em
->
getRepository
(
SolidoumeItem
::
class
)
->
findBy
([
'enabled'
=>
true
,
'paiementDate'
=>
$nowDay
]);
try
{
$em
=
$this
->
em
;
$isTest
=
$this
->
isTest
;
...
...
@@ -241,11 +234,8 @@ class SolidoumeCommand extends Command
$this
->
io
->
warning
(
"Ce n'est pas le jour d'execution du programme ("
.
$this
->
param
->
getExecutionDate
()
.
')'
);
}
else
{
$this
->
io
->
title
(
'START : Répartition de la somme récoltée'
);
if
(
!
$this
->
isTest
)
{
$items
=
$this
->
em
->
getRepository
(
SolidoumeItem
::
class
)
->
findBy
([
'enabled'
=>
true
]);
}
else
{
$items
=
$this
->
getItemsForTest
();
}
$items
=
$this
->
em
->
getRepository
(
SolidoumeItem
::
class
)
->
findBy
([
'enabled'
=>
true
]);
$total
=
0
;
$countPerson
=
0
;
$countParticipants
=
0
;
...
...
@@ -362,50 +352,4 @@ class SolidoumeCommand extends Command
return
false
;
}
/**
* Get items for local testing purpose.
*
* @return array
*/
private
function
getItemsForTest
()
{
if
(
null
==
$this
->
itemsTest
)
{
$this
->
itemsTest
=
[
$this
->
getItemForTest
(
10
,
true
,
true
,
$this
->
em
->
getRepository
(
Adherent
::
class
)
->
findOneByEmail
(
'julien.jorry@gmail.com'
)),
$this
->
getItemForTest
(
10
,
false
,
true
,
$this
->
em
->
getRepository
(
Adherent
::
class
)
->
findOneByEmail
(
'julien.jorry+22@gmail.com'
)),
$this
->
getItemForTest
(
40
,
false
,
false
,
$this
->
em
->
getRepository
(
Adherent
::
class
)
->
findOneByEmail
(
'julien.jorry+123@gmail.com'
)),
$this
->
getItemForTest
(
50
,
false
,
true
,
$this
->
em
->
getRepository
(
Adherent
::
class
)
->
findOneByEmail
(
'julien.jorry+test2@gmail.com'
)),
$this
->
getItemForTest
(
60
,
false
,
true
,
$this
->
em
->
getRepository
(
Adherent
::
class
)
->
findOneByEmail
(
'julien.jorry+testadh@gmail.com'
)),
$this
->
getItemForTest
(
70
,
true
,
false
,
$this
->
em
->
getRepository
(
Adherent
::
class
)
->
findOneByEmail
(
'julien.jorry+adh@gmail.cm'
)),
];
}
return
$this
->
itemsTest
;
}
/**
* Get one SolidouItem for local testing purpose.
*
* @param int $amount
* @param bool $donation
* @param bool $recurrent
* @param Adherent $adherent
*
* @return SolidoumeItem
*/
private
function
getItemForTest
(
int
$amount
,
bool
$donation
,
bool
$recurrent
,
Adherent
$adherent
)
{
$item0
=
new
SolidoumeItem
();
$item0
->
setAmount
(
$amount
);
$item0
->
setIsRecurrent
(
$recurrent
);
$item0
->
setIsDonation
(
$donation
);
$item0
->
setPaiementDate
(
7
);
$item0
->
setAdherent
(
$adherent
);
$item0
->
setUser
(
$this
->
em
->
getRepository
(
User
::
class
)
->
findOneByEmail
(
'julien.jorry@gmail.com'
));
$item0
->
setLastMonthPayed
(
202203
);
$item0
->
setComments
(
'test'
);
return
$item0
;
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment