Browse Source

coding guideline and behat fixes

MOODLE_29_STABLE
Dan Marsden 9 years ago
parent
commit
2373305f17
  1. 5
      locallib.php
  2. 6
      renderer.php
  3. 3
      sessions.php
  4. 2
      tests/behat/extra_features.feature

5
locallib.php

@ -1134,9 +1134,8 @@ class attendance {
public function get_user_taken_sessions_count($userid) {
if (!array_key_exists($userid, $this->usertakensesscount)) {
if (!empty($this->pageparams->startdate) && !empty($this->pageparams->enddate)) {
$this->usertakensesscount[$userid] =
att_get_user_taken_sessions_count($this->id, $this->course->startdate, $userid,
$this->cm, $this->pageparams->startdate, $this->pageparams->enddate);
$this->usertakensesscount[$userid] = att_get_user_taken_sessions_count($this->id, $this->course->startdate,
$userid, $this->cm, $this->pageparams->startdate, $this->pageparams->enddate);
} else {
$this->usertakensesscount[$userid] = att_get_user_taken_sessions_count($this->id, $this->course->startdate,
$userid, $this->cm);

6
renderer.php

@ -234,8 +234,7 @@ class mod_attendance_renderer extends plugin_renderer_base {
$dta = $this->construct_date_time_actions($sessdata, $sess);
$table->data[$sess->id][] = $i;
$table->data[$sess->id][] = $sess->groupid ? $sessdata->groups[$sess->groupid]->name :
get_string('commonsession', 'attendance');
$table->data[$sess->id][] = $sess->groupid ? $sessdata->groups[$sess->groupid]->name : get_string('commonsession', 'attendance');
$table->data[$sess->id][] = $dta['date'];
$table->data[$sess->id][] = $dta['time'];
$table->data[$sess->id][] = $sess->description;
@ -770,8 +769,7 @@ class mod_attendance_renderer extends plugin_renderer_base {
$row = new html_table_row();
$row->cells[] = $i;
$row->cells[] = html_writer::tag('nobr', $sess->groupid ? $userdata->groups[$sess->groupid]->name :
get_string('commonsession', 'attendance'));
$row->cells[] = html_writer::tag('nobr', $sess->groupid ? $userdata->groups[$sess->groupid]->name : get_string('commonsession', 'attendance'));
$row->cells[] = userdate($sess->sessdate, get_string('strftimedmyw', 'attendance'));
$row->cells[] = $this->construct_time($sess->sessdate, $sess->duration);
$row->cells[] = $sess->description;

3
sessions.php

@ -71,8 +71,7 @@ switch ($att->pageparams->action) {
if ($formdata = $mform->get_data()) {
$sessions = construct_sessions_data_for_add($formdata);
$att->add_sessions($sessions);
$message = count($sessions) == 1 ? get_string('sessiongenerated', 'attendance') :
get_string('sessionsgenerated', 'attendance', count($sessions));
$message = count($sessions) == 1 ? get_string('sessiongenerated', 'attendance') : get_string('sessionsgenerated', 'attendance', count($sessions));
mod_attendance_notifyqueue::notify_success($message);
// Redirect to the sessions tab always showing all sessions.
$SESSION->attcurrentattview[$cm->course] = ATT_VIEW_ALL;

2
tests/behat/extra_features.feature

@ -171,7 +171,6 @@ Feature: Test the various new features in the attendance module
| id_sessiondate_hour | 10 |
| id_sessiondate_minute | 0 |
And I click on "submitbutton" "button"
And I follow "Sessions"
And I follow "Add"
And I set the following fields to these values:
| Create multiple sessions | 0 |
@ -179,7 +178,6 @@ Feature: Test the various new features in the attendance module
| id_sessiondate_hour | 11 |
| id_sessiondate_minute | 0 |
And I click on "submitbutton" "button"
And I follow "Sessions"
When I click on "Take attendance" "link" in the "10:00" "table_row"
Then "Set status for all users to «Present»" "link" should exist

Loading…
Cancel
Save