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) { public function get_user_taken_sessions_count($userid) {
if (!array_key_exists($userid, $this->usertakensesscount)) { if (!array_key_exists($userid, $this->usertakensesscount)) {
if (!empty($this->pageparams->startdate) && !empty($this->pageparams->enddate)) { if (!empty($this->pageparams->startdate) && !empty($this->pageparams->enddate)) {
$this->usertakensesscount[$userid] = $this->usertakensesscount[$userid] = att_get_user_taken_sessions_count($this->id, $this->course->startdate,
att_get_user_taken_sessions_count($this->id, $this->course->startdate, $userid, $userid, $this->cm, $this->pageparams->startdate, $this->pageparams->enddate);
$this->cm, $this->pageparams->startdate, $this->pageparams->enddate);
} else { } else {
$this->usertakensesscount[$userid] = att_get_user_taken_sessions_count($this->id, $this->course->startdate, $this->usertakensesscount[$userid] = att_get_user_taken_sessions_count($this->id, $this->course->startdate,
$userid, $this->cm); $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); $dta = $this->construct_date_time_actions($sessdata, $sess);
$table->data[$sess->id][] = $i; $table->data[$sess->id][] = $i;
$table->data[$sess->id][] = $sess->groupid ? $sessdata->groups[$sess->groupid]->name : $table->data[$sess->id][] = $sess->groupid ? $sessdata->groups[$sess->groupid]->name : get_string('commonsession', 'attendance');
get_string('commonsession', 'attendance');
$table->data[$sess->id][] = $dta['date']; $table->data[$sess->id][] = $dta['date'];
$table->data[$sess->id][] = $dta['time']; $table->data[$sess->id][] = $dta['time'];
$table->data[$sess->id][] = $sess->description; $table->data[$sess->id][] = $sess->description;
@ -770,8 +769,7 @@ class mod_attendance_renderer extends plugin_renderer_base {
$row = new html_table_row(); $row = new html_table_row();
$row->cells[] = $i; $row->cells[] = $i;
$row->cells[] = html_writer::tag('nobr', $sess->groupid ? $userdata->groups[$sess->groupid]->name : $row->cells[] = html_writer::tag('nobr', $sess->groupid ? $userdata->groups[$sess->groupid]->name : get_string('commonsession', 'attendance'));
get_string('commonsession', 'attendance'));
$row->cells[] = userdate($sess->sessdate, get_string('strftimedmyw', 'attendance')); $row->cells[] = userdate($sess->sessdate, get_string('strftimedmyw', 'attendance'));
$row->cells[] = $this->construct_time($sess->sessdate, $sess->duration); $row->cells[] = $this->construct_time($sess->sessdate, $sess->duration);
$row->cells[] = $sess->description; $row->cells[] = $sess->description;

3
sessions.php

@ -71,8 +71,7 @@ switch ($att->pageparams->action) {
if ($formdata = $mform->get_data()) { if ($formdata = $mform->get_data()) {
$sessions = construct_sessions_data_for_add($formdata); $sessions = construct_sessions_data_for_add($formdata);
$att->add_sessions($sessions); $att->add_sessions($sessions);
$message = count($sessions) == 1 ? get_string('sessiongenerated', 'attendance') : $message = count($sessions) == 1 ? get_string('sessiongenerated', 'attendance') : get_string('sessionsgenerated', 'attendance', count($sessions));
get_string('sessionsgenerated', 'attendance', count($sessions));
mod_attendance_notifyqueue::notify_success($message); mod_attendance_notifyqueue::notify_success($message);
// Redirect to the sessions tab always showing all sessions. // Redirect to the sessions tab always showing all sessions.
$SESSION->attcurrentattview[$cm->course] = ATT_VIEW_ALL; $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_hour | 10 |
| id_sessiondate_minute | 0 | | id_sessiondate_minute | 0 |
And I click on "submitbutton" "button" And I click on "submitbutton" "button"
And I follow "Sessions"
And I follow "Add" And I follow "Add"
And I set the following fields to these values: And I set the following fields to these values:
| Create multiple sessions | 0 | | Create multiple sessions | 0 |
@ -179,7 +178,6 @@ Feature: Test the various new features in the attendance module
| id_sessiondate_hour | 11 | | id_sessiondate_hour | 11 |
| id_sessiondate_minute | 0 | | id_sessiondate_minute | 0 |
And I click on "submitbutton" "button" And I click on "submitbutton" "button"
And I follow "Sessions"
When I click on "Take attendance" "link" in the "10:00" "table_row" When I click on "Take attendance" "link" in the "10:00" "table_row"
Then "Set status for all users to «Present»" "link" should exist Then "Set status for all users to «Present»" "link" should exist

Loading…
Cancel
Save