src/org/ohmage/request/user/UserStatsReadRequest.java
@Override
	public void respond(HttpServletRequest httpRequest, HttpServletResponse httpResponse) {
		JSONObject jsonResult = new JSONObject();
		
		if(! isFailed()) {
			try {
				jsonResult.put(
						JSON_KEY_HOURS_SINCE_LAST_SURVEY_UPLOAD, 
						hoursSinceLastSurveyUpload);
				
				jsonResult.put(
						JSON_KEY_HOURS_SINCE_LAST_MOBILITY_UPLOAD, 
						((hoursSinceLastMobilityUpload == null) ? 
								DEFAULT_VALUE_IF_NO_MOBILITY_UPLOADS : 
								hoursSinceLastMobilityUpload)
						);
				
				jsonResult.put(
						JSON_KEY_PAST_DAY_SUCCESSFUL_SURVEY_LOCATION_UPDATES_PERCENTAGE, 
						pastDaySuccessfulSurveyLocationUpdatesPercentage);
				
				jsonResult.put(
						JSON_KEY_PAST_DAY_SUCCESSFUL_MOBILITY_LOCATION_UPDATES_PERCENTAGE, 
						((pastDatSuccessfulMobilityLocationUpdatesPercentage == null) ?
								DEFAULT_VALUE_IF_NO_MOBILITY_UPLOADS_IN_LAST_DAY : 
								pastDatSuccessfulMobilityLocationUpdatesPercentage)
						);
			}
			catch(JSONException e) {
				LOGGER.error("There was an error creating the JSONArray result object.", e);
				setFailed();
			}
		}
		
		super.respond(httpRequest, httpResponse, JSON_KEY_RESULT, jsonResult);
	}
/**
	 * Responds to the user's request.
	 */
Responds to the user's request.
Responds to the user ' s request .
@Override
	public void respond(HttpServletRequest httpRequest, HttpServletResponse httpResponse) {
		JSONObject jsonResult = new JSONObject();
		if(! isFailed()) {
			try {
				jsonResult.put(
						JSON_KEY_HOURS_SINCE_LAST_SURVEY_UPLOAD, 
						hoursSinceLastSurveyUpload);
				jsonResult.put(
						JSON_KEY_HOURS_SINCE_LAST_MOBILITY_UPLOAD, 
						((hoursSinceLastMobilityUpload == null) ? 
								DEFAULT_VALUE_IF_NO_MOBILITY_UPLOADS : 
								hoursSinceLastMobilityUpload)
						);
				jsonResult.put(
						JSON_KEY_PAST_DAY_SUCCESSFUL_SURVEY_LOCATION_UPDATES_PERCENTAGE, 
						pastDaySuccessfulSurveyLocationUpdatesPercentage);
				jsonResult.put(
						JSON_KEY_PAST_DAY_SUCCESSFUL_MOBILITY_LOCATION_UPDATES_PERCENTAGE, 
						((pastDatSuccessfulMobilityLocationUpdatesPercentage == null) ?
								DEFAULT_VALUE_IF_NO_MOBILITY_UPLOADS_IN_LAST_DAY : 
								pastDatSuccessfulMobilityLocationUpdatesPercentage)
						);
			}
			catch(JSONException e) {
				LOGGER.error("There was an error creating the JSONArray result object.", e);
				setFailed();
			}
		}
		super.respond(httpRequest, httpResponse, JSON_KEY_RESULT, jsonResult);
	}
@ Override public void respond ( HttpServletRequest httpRequest , HttpServletResponse httpResponse ) { JSONObject jsonResult = new JSONObject ( ) ; if ( ! isFailed ( ) ) { try { jsonResult . put ( JSON_KEY_HOURS_SINCE_LAST_SURVEY_UPLOAD , hoursSinceLastSurveyUpload ) ; jsonResult . put ( JSON_KEY_HOURS_SINCE_LAST_MOBILITY_UPLOAD , ( ( hoursSinceLastMobilityUpload == null ) ? DEFAULT_VALUE_IF_NO_MOBILITY_UPLOADS : hoursSinceLastMobilityUpload ) ) ; jsonResult . put ( JSON_KEY_PAST_DAY_SUCCESSFUL_SURVEY_LOCATION_UPDATES_PERCENTAGE , pastDaySuccessfulSurveyLocationUpdatesPercentage ) ; jsonResult . put ( JSON_KEY_PAST_DAY_SUCCESSFUL_MOBILITY_LOCATION_UPDATES_PERCENTAGE , ( ( pastDatSuccessfulMobilityLocationUpdatesPercentage == null ) ? DEFAULT_VALUE_IF_NO_MOBILITY_UPLOADS_IN_LAST_DAY : pastDatSuccessfulMobilityLocationUpdatesPercentage ) ) ; } catch ( JSONException e ) { LOGGER . error ( "There was an error creating the JSONArray result object." , e ) ; setFailed ( ) ; } } super . respond ( httpRequest , httpResponse , JSON_KEY_RESULT , jsonResult ) ; }
Responds to the user's request.
Responds to the user ' s request .