You are here

function CourseObjectPollFulfillment::delete in Course 7.2

Remove poll votes for this user.

Overrides CourseObjectNodeFulfillment::delete

File

modules/course_poll/CourseObjectPollFulfillment.php, line 8

Class

CourseObjectPollFulfillment

Code

function delete() {
  $account = user_load($this->uid);
  db_delete('poll_vote')
    ->condition('nid', $this
    ->getCourseObject()
    ->getInstanceId())
    ->condition('uid', $account->uid)
    ->execute();
  db_update('poll_choice')
    ->expression('chvotes', 'chvotes - 1')
    ->condition('chid', $this
    ->getOption('instance'))
    ->execute();
  parent::delete();
}