Skip to content

Commit

Permalink
calculatedavailability test uses start/end not startformatted,
Browse files Browse the repository at this point in the history
endformatted
  • Loading branch information
marcusgreen committed May 29, 2024
1 parent 412ce53 commit 8170de1
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion templates/assign.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@

{{#isheader}}
<tr>
<td colspan="6 ">{{#str}} session, tool_driprelease {{/str}} {{{calculatedavailability.sessioncounter}}}: {{calculatedavailability.startformatted}} - {{calculatedavailability.endformatted}}</td>
<td colspan="6 ">{{#str}} session, tool_driprelease {{/str}} {{{calculatedavailability.sessioncounter}}}: {{calculatedavailability.start}} - {{calculatedavailability.end}}</td>
</tr>
{{/isheader}}

Expand Down
8 changes: 4 additions & 4 deletions templates/quiz.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
* name - text name of the module
* intro -text
* sessioncounter -int count of this session, i.e. first 7 days of 7 day long sessions
* startformatted - start date
* endformatted - finish date
* start - start date
* end - finish date
Example context (json):
Expand All @@ -47,8 +47,8 @@
"intro":"",
"calculatedavailability":{
"sessioncounter":1,
"startformatted":"Thu 5 Jan 2023 22:12",
"endformatted":"Thu 12 Jan 2023 22:12"
"start":"Thu 5 Jan 2023 22:12",
"end":"Thu 12 Jan 2023 22:12"
}
}
}}
Expand Down
10 changes: 6 additions & 4 deletions tests/driprelease_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -169,11 +169,13 @@ public function test_get_table_data() {
$this->assertEquals($row1['selected'], "checked");
$this->assertEquals($row1['questioncount'], 0);

$this->assertEquals("Sun 1 Jan 2023 00:00", $row1['calculatedavailability']['startformatted']);
$this->assertEquals("Sun 1 Jan 2023 00:00", $row1['calculatedavailability']['endformatted']);
// Sundays quiz.
$this->assertEquals(mktime(0, 0, 0, 1, 1, 2023), $row1['calculatedavailability']['start']);
$this->assertEquals(mktime(0, 0, 0, 1, 1, 2023), $row1['calculatedavailability']['end']);

$this->assertEquals("Mon 2 Jan 2023 00:00", $row2['calculatedavailability']['startformatted']);
$this->assertEquals("Mon 2 Jan 2023 00:00", $row2['calculatedavailability']['endformatted']);
// Mondays quiz.
$this->assertEquals(mktime(0, 0, 0, 1, 2, 2023), $row2['calculatedavailability']['start']);
$this->assertEquals(mktime(0, 0, 0, 1, 2, 2023), $row2['calculatedavailability']['end']);
}
/**
* Check that update doesn't fall over and
Expand Down

0 comments on commit 8170de1

Please sign in to comment.