<commit_before>package ch.uzh.csg.reimbursement.service;

import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.Set;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestClientException;
import org.springframework.web.client.RestTemplate;

import ch.uzh.csg.reimbursement.dto.ExchangeRateDto;
import ch.uzh.csg.reimbursement.model.exception.InvalidDateException;

@Service
public class ExchangeRateService {

	@Value("${reimbursement.exchangeRate.url}")
	private String providerUrl;

	@Value("${reimbursement.exchangeRate.base}")
	private String base;

	@Cacheable("exchange-rates")
	public ExchangeRateDto getExchangeRateFrom(String date) {
		String url = generateUrl(date);

		RestTemplate restTemplate = new RestTemplate();
		ExchangeRateDto exchangeRateDto = null;

		try {
			exchangeRateDto = restTemplate.getForObject(url, ExchangeRateDto.class);
		} catch (RestClientException e) {
		}

		/*
		 * If the date argument is not valid, the server returns an HTTP status
		 * error code. This error is wrapped here.
		 */
		if (exchangeRateDto == null) {
			throw new InvalidDateException(date);
		}

		return exchangeRateDto;
	}

	public List<String> getSupportedCurrencies() {
		ExchangeRateDto dto = getExchangeRateFrom(new SimpleDateFormat("yyyy-MM-dd").format(new Date()));
		Set<String> set = dto.getRates().keySet();
		set.add(dto.getBase());

		List<String> list = new ArrayList<>();
		list.addAll(set);
		Collections.sort(list);

		return list;
	}

	private String generateUrl(String date) {
		return providerUrl + date + "?base=" + base;
	}

}<commit_msg>add base currency also to supported currency list<commit_after>package ch.uzh.csg.reimbursement.service;

import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.Set;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestClientException;
import org.springframework.web.client.RestTemplate;

import ch.uzh.csg.reimbursement.dto.ExchangeRateDto;
import ch.uzh.csg.reimbursement.model.exception.InvalidDateException;

@Service
public class ExchangeRateService {

	@Value("${reimbursement.exchangeRate.url}")
	private String providerUrl;

	@Value("${reimbursement.exchangeRate.base}")
	private String base;

	@Cacheable("exchange-rates")
	public ExchangeRateDto getExchangeRateFrom(String date) {
		String url = generateUrl(date);

		RestTemplate restTemplate = new RestTemplate();
		ExchangeRateDto exchangeRateDto = null;

		try {
			exchangeRateDto = restTemplate.getForObject(url, ExchangeRateDto.class);
		} catch (RestClientException e) {
		}

		/*
		 * If the date argument is not valid, the server returns an HTTP status
		 * error code. This error is wrapped here.
		 */
		if (exchangeRateDto == null) {
			throw new InvalidDateException(date);
		}

		return exchangeRateDto;
	}

	public List<String> getSupportedCurrencies() {
		ExchangeRateDto dto = getExchangeRateFrom(new SimpleDateFormat("yyyy-MM-dd").format(new Date()));
		Set<String> set = dto.getRates().keySet();

		List<String> list = new ArrayList<>();
		list.addAll(set);
		list.add(dto.getBase());
		Collections.sort(list);

		return list;
	}

	private String generateUrl(String date) {
		return providerUrl + date + "?base=" + base;
	}

}
{'fraction_non_alphanumeric': 0.11307420494699646, 'fraction_numerical': 0.0, 'mean_word_length': 5.216216216216216, 'pattern_counts': {'":': 0, '<': 11, '<?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': '3317511', 'n_tokens_mistral': 1214, 'n_tokens_neox': 1120, 'n_words': 245}