Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions registration-system/admin/pages_mail.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,13 @@ public function getText() {
foreach ($this->environment->oconfig['essen'] as $key => $typ) {
$essen .= '<option value="' . $key . '">' . $typ . '</option>';
}
$maxtage = $this->fahrt->getLenTage();
$fahrt_bereich = $this->environment->database->select('fahrten', ['von', 'bis'], ['fahrt_id' => $this->fahrt->getID()]);

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nicht so elegant...
Lieber die entsprechende Funktion aus dem Fahrt-Objekt nehmen (bzw neu schreiben)! Ist einheitlicher und wenn sich was ändert, dann nur an einer Stelle. Dafür ist die Klasse ja da.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sehe ich mir an

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nutzt fahrt->getPossibleDates() in der neuen version

$von = strtotime($fahrt_bereich[0]['von']);
$bis = strtotime($fahrt_bereich[0]['bis']);

$tage = '';
for ($cnt = $maxtage; $cnt >= 0; $cnt--)
$tage .= '<option value="' . $cnt . '">' . $cnt . '</option>';
for ($tag = $von; $tag < $bis; $tag += 24*60*60)
$tage .= '<option value="' . date('Y-m-d', $tag) . '">' . date('d.m.Y', $tag) . '</option>';

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warum zwei verschiedene datumsformate? ist das in der DB so? mir ist so, als wäre da irgendwo im environment eine funktion für datumsangaben. wäre wünschenswert die zu nutzen!

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

datumsformate sind so in der db - das rechte ist 'menschenleserlich'


return '
<script type="text/javascript">
Expand Down Expand Up @@ -138,7 +141,7 @@ private function transformContacts() {
}

private function buildQueryWhere() {
$where = ['fahrt_id' => $this->fahrt->getID(), 'OR' => ['on_waitlist' => 0,
$where = ['fahrt_id' => $this->fahrt->getID(), 'OR #waitlist' => ['on_waitlist' => 0,

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

was ist das denn mit der raute? neue medoo Syntax?
Sieht so aus, als sollte da on_waitlist stehen (?)

@0x17de 0x17de Oct 20, 2017

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

das mit kommentar muss so. es gibt ja nun auch ein OR weiter unten bei nights. zwei or MUSS man mit medoo so lösen leider. wegen unique map keys

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kannte ich noch nicht, dachte das wäre nur irgendwie die neue syntax oder so.

'AND' => [
'transferred[!]' => null,
'on_waitlist' => 1
Expand All @@ -154,7 +157,12 @@ private function buildQueryWhere() {
$where['abtyp'] = $_REQUEST['val_abtyp'];
}
if (isset($_REQUEST['check_nights'])) {
// TODO
$nights = $_REQUEST['val_nights'];
$conditions = [];
foreach ($nights as $night)
$conditions['AND #'.$night] = ['anday[<=]' => $night, 'abday[>]' => $night];

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Definitionssache, aber ich finde, dass die Logik falsch ist.
Wenn ich wähle, dass ich an Personen mailen will die an Tag 1, 2, und 3 da sind, dann meine ich nicht 'und' an allen Tagen, sondern meine die Leute, die an min einem der gwählten Tage da sind (glaube ich). Trippy.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah. gute frage - ja, hier ist angenommen: an mindestens einer der selektierten nächte da. nicht gesagt 'NUR' in den nächten da.

if (sizeof($conditions) > 0)
$where['OR #nights'] = $conditions;

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warum ist hier ein OR und bei allen anderen keys in $where nicht?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wegen 'in mindestens einer selektierten nacht anwesend' logik

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ja, das stimmt schon, bin mir nur nicht sicher, ob man lustige Seiteneffekte bekommt (Klammern/Scopes).

Beispiel: [[bezahlt] UND [auto] ODER [nacht1] ODER [nacht1 UND nacht2]]
Wäre ja doof dann, weil die beiden anderen (bezahlt, auto) irrelevant werden.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

die oberste ebene ist via und verknüpft - darunter sind die einzelnen nächte via oder verknüpft. also hat keine aushebelnde wirkung auf die bisherige selektion

}
if (isset($_REQUEST['check_essen'])) {
$where['essen'] = $_REQUEST['val_essen'];
Expand Down