<commit_before>import { Injectable } from '@angular/core';
import { FeathersProvider } from './feathers';

@Injectable()
export class AttendanceProvider {
  attendance = this.app.service('attendance');

  constructor(public app: FeathersProvider) { }

  find(room) {
    return this.attendance.find({
      query: {
        $limit: 1,
        room: room._id,
        online: true,
      },
      rx: {
        listStrategy: 'always'
      }
    });
  }

  get(id) {
    return this.attendance.get(id);
  }

  setAttendance(attendance, student, value) {
    console.info('value', value);
    return this.attendance.patch(attendance._id, {
      ['students.$.present']: value,
    }, {
      query: {
        'students._id': student._id,
        $select: ['_id']
      }
    });
  }

  all(room) {
    return this.attendance.find({
      query: {
        room: room._id,
      },
      rx: {
        listStrategy: 'always'
      }
    });
  }

  room(room, student) {
    return this.attendance.find({
      query: {
        room: room._id,
        online: true,
        $select: ['']
      }
    });
  }

  attendanceRoom(attendance) {
    return this.attendance.find({
      query: {
        _id: attendance._id,
        online: false,
        $select: ['']
      },
      rx: {
        listStrategy: 'always'
      }
    });
  }

  stop(attendance) {
    return this.attendance.patch(attendance._id, {
      online: false,
    }, {
      query: {
        $select: ['']
      }
    });
  }

  take(attendance, code, student) {
    return this.attendance.patch(null, {
      ['students.$.present']: true,
    }, {
      query: {
        _id: attendance._id,
        code: code,
        online: true,
        'students._id': student._id,
        $select: ['']
      }
    });
  }

  create(attendance) {
    return this.attendance.create(attendance);
  }

  edit(attendance) {
    return this.attendance.patch(attendance._id, {
      text: attendance.text
    });
  }

  remove(attendance) {
    return this.attendance.remove(attendance._id);
  }
}
<commit_msg>feat(attendance): add sort, remove console, select<commit_after>import { Injectable } from '@angular/core';
import { FeathersProvider } from './feathers';

@Injectable()
export class AttendanceProvider {
  attendance = this.app.service('attendance');

  constructor(public app: FeathersProvider) { }

  find(room) {
    return this.attendance.find({
      query: {
        $limit: 1,
        room: room._id,
        online: true,
      },
      rx: {
        listStrategy: 'always'
      }
    });
  }

  get(id) {
    return this.attendance.get(id);
  }

  setAttendance(attendance, student, value) {
    return this.attendance.patch(attendance._id, {
      ['students.$.present']: value,
    }, {
      query: {
        'students._id': student._id,
        $select: ['_id']
      }
    });
  }

  all(room) {
    return this.attendance.find({
      query: {
        room: room._id,
        $sort: {
          createdAt: 1
        }
      },
      rx: {
        listStrategy: 'always'
      }
    });
  }

  room(room, student) {
    return this.attendance.find({
      query: {
        room: room._id,
        online: true,
        $select: ['_id', 'room']
      }
    });
  }

  attendanceRoom(attendance) {
    return this.attendance.find({
      query: {
        _id: attendance._id,
        online: false,
        $select: ['']
      },
      rx: {
        listStrategy: 'always'
      }
    });
  }

  stop(attendance) {
    return this.attendance.patch(attendance._id, {
      online: false,
    }, {
      query: {
        $select: ['']
      }
    });
  }

  take(attendance, code, student) {
    return this.attendance.patch(null, {
      ['students.$.present']: true,
    }, {
      query: {
        _id: attendance._id,
        code: code,
        online: true,
        'students._id': student._id,
        $select: ['']
      }
    });
  }

  create(attendance) {
    return this.attendance.create(attendance);
  }

  edit(attendance) {
    return this.attendance.patch(attendance._id, {
      text: attendance.text
    });
  }

  remove(attendance) {
    return this.attendance.remove(attendance._id);
  }
}

{'fraction_non_alphanumeric': 0.15112386417981827, 'fraction_numerical': 0.0007173601147776184, 'mean_word_length': 1.9354385964912282, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '896472', 'n_tokens_mistral': 1391, 'n_tokens_neox': 1438, 'n_words': 234}