<commit_before><?php
namespace Dime\OfferBundle\Handler;

use Dime\OfferBundle\Entity\Offer;
use Dime\TimetrackerBundle\Entity\Activity;
use Dime\TimetrackerBundle\Entity\Project;
use Dime\TimetrackerBundle\Handler\GenericHandler;
use Dime\TimetrackerBundle\Entity\RateUnitType;

class OfferHandler extends GenericHandler
{
    /**
     * Creates a Project from an Offer
     *
     * @param Offer $offer
     *
     * @return \Dime\TimetrackerBundle\Entity\Project
     */
    public function createProjectFromOffer(Offer $offer)
    {
        $project = $offer->getProject();
        if ($project !== null) {
            return $project;
        }

        $project = new Project();
        $project->setCustomer($offer->getCustomer());
        $project->setName($offer->getName());
        $project->setChargeable(true);
        if ($offer->getRateGroup() !== null) {
            $project->setRateGroup($offer->getRateGroup());
        } elseif ($offer->getCustomer() !== null) {
            $project->setRateGroup($offer->getCustomer()->getRateGroup());
        }
        $project->setDescription($offer->getShortDescription());
        if ($offer->getFixedPrice()->isZero()) {
            $project->setBudgetPrice($offer->getSubtotal());
        } else {
            $project->setBudgetPrice($offer->getFixedPrice());<commit_msg>fixed conditional where offer fixed price was null<commit_after><?php
namespace Dime\OfferBundle\Handler;

use Dime\OfferBundle\Entity\Offer;
use Dime\TimetrackerBundle\Entity\Activity;
use Dime\TimetrackerBundle\Entity\Project;
use Dime\TimetrackerBundle\Handler\GenericHandler;
use Dime\TimetrackerBundle\Entity\RateUnitType;

class OfferHandler extends GenericHandler
{
    /**
     * Creates a Project from an Offer
     *
     * @param Offer $offer
     *
     * @return \Dime\TimetrackerBundle\Entity\Project
     */
    public function createProjectFromOffer(Offer $offer)
    {
        $project = $offer->getProject();
        if ($project !== null) {
            return $project;
        }

        $project = new Project();
        $project->setCustomer($offer->getCustomer());
        $project->setName($offer->getName());
        $project->setChargeable(true);
        if ($offer->getRateGroup() !== null) {
            $project->setRateGroup($offer->getRateGroup());
        } elseif ($offer->getCustomer() !== null) {
            $project->setRateGroup($offer->getCustomer()->getRateGroup());
        }
        $project->setDescription($offer->getShortDescription());
        if ($offer->getFixedPrice() != null && $offer->getFixedPrice()->isZero()) {
            $project->setBudgetPrice($offer->getSubtotal());
        } else {
            $project->setBudgetPrice($offer->getFixedPrice());
{'fraction_non_alphanumeric': 0.1478102189781022, 'fraction_numerical': 0.0, 'mean_word_length': 3.02496328928047, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 46, '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': '6806644', 'n_tokens_mistral': 800, 'n_tokens_neox': 763, 'n_words': 126}