<commit_before>import { Observable, ReplaySubject, Subject } from 'rxjs'
import { Event } from 'services/event'
import { Attendee } from './attendee'

import { API_BASE, API_EVENTS, API_ATTEND ,API_ATTENDEES, API_USERS } from 'common/constants'
import { http } from 'services/net'

/**
 * Status codes:
 * 50:
 *   des: no user with given username 
 *   context: try to register rfid for a user
 *   http: status: 400 BAD_REQUEST
 * 40:
 *   des: no user with given rfid
 *   context: try to register with an rfid that is not bound to a user'
 *   http: status: 400 BAD_REQUEST
 * 30:
 *   des: Attendee is on waitinglist
 *   context: try to register an attendee when attendee is on waitinglist, force option = false'
 *   http: status: 100 CONTINUE
 * 20:
 *   des: Attendee has already registered
 *   context: try to register attendee when attendee is already registered
 *   http: status: 400 BAD_REQUEST
 * 10:
 *   des: Attendee successfuly registered
 *   context: try to register an attendee
 *   http: status: 200 OK 
 */

interface IAttendeeService{
  //Fetch events
  getAttendees(event: Event): Observable<Attendee[]>;
  //registerAttendee(rfid: string): Observable<Attendee>;
  //registerRfid(rfid: string, username: string): Observable<Attendee>;
}




class AttendeeServiceProvider implements IAttendeeService{
  
  constructor(){
    this.cache = {}
  }

  registerAttendee(event:Event, rfid: string){
    return this.handleResponse(http.post(`${API_BASE}${API_ATTEND}`,{
      rfid: rfid,
      event: event.id
    }))
      .map(res => {
        let ret = Object.assign({},res,{
          event: event
        })
        return ret;<commit_msg>Added argument for approving person on waitlist<commit_after>import { Observable, ReplaySubject, Subject } from 'rxjs'
import { Event } from 'services/event'
import { Attendee } from './attendee'

import { API_BASE, API_EVENTS, API_ATTEND ,API_ATTENDEES, API_USERS } from 'common/constants'
import { http } from 'services/net'

/**
 * Status codes:
 * 50:
 *   des: no user with given username 
 *   context: try to register rfid for a user
 *   http: status: 400 BAD_REQUEST
 * 40:
 *   des: no user with given rfid
 *   context: try to register with an rfid that is not bound to a user'
 *   http: status: 400 BAD_REQUEST
 * 30:
 *   des: Attendee is on waitinglist
 *   context: try to register an attendee when attendee is on waitinglist, force option = false'
 *   http: status: 100 CONTINUE
 * 20:
 *   des: Attendee has already registered
 *   context: try to register attendee when attendee is already registered
 *   http: status: 400 BAD_REQUEST
 * 10:
 *   des: Attendee successfuly registered
 *   context: try to register an attendee
 *   http: status: 200 OK 
 */

interface IAttendeeService{
  //Fetch events
  getAttendees(event: Event): Observable<Attendee[]>;
  //registerAttendee(rfid: string): Observable<Attendee>;
  //registerRfid(rfid: string, username: string): Observable<Attendee>;
}




class AttendeeServiceProvider implements IAttendeeService{
  
  constructor(){
    this.cache = {}
  }

  registerAttendee(event:Event, rfid: string, approved: boolean = false){
    return this.handleResponse(http.post(`${API_BASE}${API_ATTEND}`,{
      rfid: rfid,
      event: event.id,
      approved: approved
    }))
      .map(res => {
        let ret = Object.assign({},res,{
          event: event
        })
        return ret;
{'fraction_non_alphanumeric': 0.1046000585994726, 'fraction_numerical': 0.01464986815118664, 'mean_word_length': 3.462745098039216, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 11, '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': '4807681', 'n_tokens_mistral': 1139, 'n_tokens_neox': 1068, 'n_words': 348}