GetJedi/app/src/main/java/edu/getjedi/frontend/mobile/state/ClientLoggedState.java
private String[] findProfessionalAndServiceByEmail(String email){
        String[] results = new String[2];
        results[0] = "";
        results[1] = "";
        try {
            for (int j = 0; j < users.length(); j++) {
                JSONObject user = users.getJSONObject(j);
                if (user.getString("mail").equals(email)) {
                    results[0] = user.getString("_id");
                    break;
                }
            }
            for (int j = 0; j < services.length(); j++) {
                JSONObject service = services.getJSONObject(j);
                if (service.getString("professionalId").equals(results[0])) {
                    results[1] = service.getString("_id");
                    break;
                }
            }
        }catch (Exception e){
            e.printStackTrace();
        }
        return results;
    }
/**
     * Returns a String array with the professional id for a email into the position 0, and the service it offers into position 1
     */
Returns a String array with the professional id for a email into the position 0, and the service it offers into position 1
Returns a String array with the professional id for a email into the position 0 and the service it offers into position 1
private String[] findProfessionalAndServiceByEmail(String email){
        String[] results = new String[2];
        results[0] = "";
        results[1] = "";
        try {
            for (int j = 0; j < users.length(); j++) {
                JSONObject user = users.getJSONObject(j);
                if (user.getString("mail").equals(email)) {
                    results[0] = user.getString("_id");
                    break;
                }
            }
            for (int j = 0; j < services.length(); j++) {
                JSONObject service = services.getJSONObject(j);
                if (service.getString("professionalId").equals(results[0])) {
                    results[1] = service.getString("_id");
                    break;
                }
            }
        }catch (Exception e){
            e.printStackTrace();
        }
        return results;
    }
private String [ ] findProfessionalAndServiceByEmail ( String email ) { String [ ] results = new String [ 2 ] ; results [ 0 ] = "" ; results [ 1 ] = "" ; try { for ( int j = 0 ; j < users . length ( ) ; j ++ ) { JSONObject user = users . getJSONObject ( j ) ; if ( user . getString ( "mail" ) . equals ( email ) ) { results [ 0 ] = user . getString ( "_id" ) ; break ; } } for ( int j = 0 ; j < services . length ( ) ; j ++ ) { JSONObject service = services . getJSONObject ( j ) ; if ( service . getString ( "professionalId" ) . equals ( results [ 0 ] ) ) { results [ 1 ] = service . getString ( "_id" ) ; break ; } } } catch ( Exception e ) { e . printStackTrace ( ) ; } return results ; }
Returns a String array with the professional id for a email into the position 0, and the service it offers into position 1
Returns a String array with the professional id for a email into the position 0 and the service it offers into position 1