public OfferResponseReason? Evaluate(IHub services, Company company, Person person, decimal amount) { var workload = 0m; if (company.Employees.Any()) { workload = (decimal)company.Projects.Count / (decimal)company.Employees.Count; } var personService = services.Resolve<IPersonService>(); var minWorkload = person.GetPersonalityValue(PersonalityAttributeId.MinimumDesiredEmployeeWorkload); var maxWorkload = person.GetPersonalityValue(PersonalityAttributeId.MaximumDesiredEmployeeWorkload); if (workload >= minWorkload && workload <= maxWorkload) { return null; } return OfferResponseReason.EmployeeWorkload; }
public OfferResponseReason? Evaluate(IHub services, Company company, Person person, decimal amount) { var configurationService = services.Resolve<IConfigurationService>(); var fastCompanyGrowth = configurationService.GetIntValue(ConfigurationKey.FastCompanyGrowthValue, ConfigurationFallbackValue.FastCompanyGrowthValue); var weight = Math.Min((decimal)company.Prospects.Count / (decimal)fastCompanyGrowth, 1m); var desiredGrowth = person.GetPersonalityValue(PersonalityAttributeId.DesiredCompanyGrowth); var importance = person.GetPersonalityValue(PersonalityAttributeId.CompanyGrowthImportance); var differential = Math.Abs(desiredGrowth - weight) * importance; var maxDifferential = configurationService.GetDecimalValue(ConfigurationKey.CompanyGrowthMaxDifferential, ConfigurationFallbackValue.CompanyGrowthMaxDifferential); if (differential <= maxDifferential) { return null; } return OfferResponseReason.CompanyGrowth; }
public OfferResponseReason? Evaluate(IHub services, Company company, Person person, decimal amount) { var configurationService = services.Resolve<IConfigurationService>(); var largeCompanySize = configurationService.GetIntValue(ConfigurationKey.LargeCompanySize, ConfigurationFallbackValue.LargeCompanySize); var weight = Math.Min((decimal)company.Employees.Count / (decimal)largeCompanySize, 1m); var desiredSize = person.GetPersonalityValue(PersonalityAttributeId.DesiredCompanySize); var importance = person.GetPersonalityValue(PersonalityAttributeId.CompanySizeImportance); var differential = Math.Abs(desiredSize - weight) * importance; var maxDifferential = configurationService.GetDecimalValue(ConfigurationKey.CompanySizeMaxDifferential, ConfigurationFallbackValue.CompanySizeMaxDifferential); if (differential <= maxDifferential) { return null; } return OfferResponseReason.CompanySize; }
public OfferResponseReason? Evaluate(IHub services, Company company, Person person, decimal amount) { // Create a flag table of the optional skills this person has var skills = person.Skills.Where(s => !s.SkillDefinition.IsMandatory) .ToDictionary(s => s.SkillDefinition, s => false); foreach(var project in company.Projects) { foreach(var requirement in project.Requirements) { if(skills.ContainsKey(requirement.SkillDefinition)) { skills[requirement.SkillDefinition] = true; } } } var relevance = 1m; if (skills.Count > 0) { relevance = (decimal)skills.Count(s => s.Value) / (decimal)skills.Count; } var minRelevance = person.GetPersonalityValue(PersonalityAttributeId.MinimumDesiredRelevance); var maxRelevance = person.GetPersonalityValue(PersonalityAttributeId.MaximumDesiredRelevance); if(minRelevance <= relevance && relevance <= maxRelevance) { return null; } return OfferResponseReason.Relevance; }
public OfferResponseReason? Evaluate(IHub services, Company company, Person person, decimal amount) { var perkService = services.Resolve<IPerkService>(); var applicablePerkCount = company.Perks.Count(cp => cp.Count > 0 && perkService.DoesPerkApplyTo(cp.Perk, person)); var personService = services.Resolve<IPersonService>(); var minimumPerkCount = person.GetPersonalityValue(PersonalityAttributeId.MinimumPerkCount); if(minimumPerkCount <= applicablePerkCount) { return null; } return OfferResponseReason.Perks; }