<commit_before>package com.wordwise.gameengine.level;

import com.wordwise.server.dto.DTODifficulty;

public class GameFinishPartialPromotion extends GameFinishPromotion{
	private int successfulNumber;
	private int totalNumber;
	
	//not allowed
	@SuppressWarnings("unused")
	private GameFinishPartialPromotion(){}
	
	public GameFinishPartialPromotion(int successfulNumber, int totalNumber){
		this.successfulNumber = successfulNumber;
		this.totalNumber = totalNumber;
		if(successfulNumber > totalNumber)
			this.successfulNumber = this.totalNumber;
	}
	
	@Override
	public int getPoints(DTODifficulty difficulty) {
		int points = super.getPoints(difficulty);
		float successRatio = (float)successfulNumber /  (float)totalNumber;
		//return the partially applied points depending on success ratio
		return (int) (points * successRatio);	
	}

}<commit_msg>Bugfix : partial promotion.<commit_after>package com.wordwise.gameengine.level;

import com.wordwise.server.dto.DTODifficulty;

public class GameFinishPartialPromotion extends GameFinishPromotion{
	private int successfulNumber;
	private int totalNumber;
	
	//not allowed
	@SuppressWarnings("unused")
	private GameFinishPartialPromotion(){}
	
	public GameFinishPartialPromotion(int successfulNumber, int totalNumber){
		this.successfulNumber = successfulNumber;
		this.totalNumber = totalNumber;
		if(successfulNumber > totalNumber)
			this.successfulNumber = this.totalNumber;
	}
	
	@Override
	public int getPoints(DTODifficulty difficulty) {
		int points = super.getPoints(difficulty);
		float successRatio = (float)successfulNumber /  (float)totalNumber;
		//return the partially applied points depending on success ratio
		return (int) Math.ceil(points * successRatio);	
	}

}
{'fraction_non_alphanumeric': 0.08242074927953891, 'fraction_numerical': 0.0, 'mean_word_length': 5.834645669291339, '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': '4153780', 'n_tokens_mistral': 517, 'n_tokens_neox': 488, 'n_words': 118}