<commit_before>import { SEND_STOPREQUEST, RECEIVE_CONFIRM } from '../actions/sendStoprequest'
import {RESET_STATE} from '../actions/resetStateAction'
import { ActionConst } from 'react-native-router-flux'

let initialState = {
    stops: [],
    isFetching: false,
    isReady: false,
    sentStoprequestFromStop: false,
    sentStoprequestFromVehicle: false,
    error: false,
    startStop: null,
    currentVehicle: null
}

const stopRequestReducer = (state = initialState, action) =>
{
    switch (action.type)
    {
    case SEND_STOPREQUEST:
        if (action.fromVehicle)
        {
            return Object.assign({}, state, {sentStoprequestFromVehicle: action.sentStoprequest})
        }
        else
        {
            return Object.assign({}, state, {sentStoprequestFromStop: action.sentStoprequest})
        }


    case RECEIVE_CONFIRM:
        if (action.fromVehicle)
        {
            return Object.assign({}, state, {sentStoprequestFromVehicle: action.sentStoprequest})
        }
        else
        {
            return Object.assign({}, state, {
                sentStoprequestFromStop: action.sentStoprequest,
                startStop: action.stop,
                currentVehicle: action.vehicle
            })
        }

    case RESET_STATE:
        return Object.assign({}, state, initialState)

    case ActionConst.FOCUS:
        return Object.assign({}, state, { sentStoprequest: false })

    default:
        return state
    }
}

export default stopRequestReducer<commit_msg>assign stoprequest request_id response to state<commit_after>import { SEND_STOPREQUEST, RECEIVE_CONFIRM, SET_STOPREQUEST_REQUEST_ID_DESTINATION, SET_STOPREQUEST_REQUEST_ID_FROM } from '../actions/sendStoprequest'
import { RESET_STATE } from '../actions/resetStateAction'

let initialState = {
    stops: [],
    isFetching: false,
    isReady: false,
    sentStoprequestFromStop: false,
    sentStoprequestFromVehicle: false,
    error: false,
    startStop: null,
    currentVehicle: null,
    fromRequestId: null,
    destinationRequestId: null
}

const stopRequestReducer = (state = initialState, action) =>
{
    switch (action.type)
    {
    case SEND_STOPREQUEST:
        if (action.fromVehicle)
        {
            return Object.assign({}, state, {sentStoprequestFromVehicle: action.stopRequestSent})
        }
        else
        {
            return Object.assign({}, state, {sentStoprequestFromStop: action.stopRequestSent})
        }


    case RECEIVE_CONFIRM:
        if (action.fromVehicle)
        {
            return Object.assign({}, state, {sentStoprequestFromVehicle: action.stopRequestSent})
        }
        else
        {
            return Object.assign({}, state, {
                sentStoprequestFromStop: action.stopRequestSent,
                startStop: action.stop,
                currentVehicle: action.vehicle
            })
        }

    case RESET_STATE:
        return Object.assign({}, state, initialState)

    case SET_STOPREQUEST_REQUEST_ID_DESTINATION:
        return Object.assign({}, state, { fromRequestId: action.requestId })
    break

    case SET_STOPREQUEST_REQUEST_ID_FROM:
        return Object.assign({}, state, { destinationRequestId: action.requestId })
    break

    default:
        return state
    }
}

export default stopRequestReducer
{'fraction_non_alphanumeric': 0.09263729631864816, 'fraction_numerical': 0.0, 'mean_word_length': 2.553054662379421, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '953335', 'n_tokens_mistral': 947, 'n_tokens_neox': 940, 'n_words': 195}