Ad
  • Custom User Avatar

    Because there isn't round function for floats. Round() require the 'numeric' type in Postgresql

  • Custom User Avatar

    expected: [{:average_salary=>99886.55, :job_title=>"mechanic", :total_people=>1, :total_salary=>99886.55}, {:av....29}, {:average_salary=>12786.66, :job_title=>"painter", :total_people=>1, :total_salary=>12786.66}]
    got: [{:average_salary=>99886.55, :job_title=>"mechanic", :total_people=>1, :total_salary=>99886.55}, {:av....29}, {:average_salary=>12786.66, :job_title=>"painter", :total_people=>1, :total_salary=>12786.66}]

    That's all.

  • Custom User Avatar

    Even when I hard code a value I get the same error

    Error:
    total_salary
    should be 2 or less decimal places
    expected: <= 2
    got: 16

    job_title average_salary total_people total_salary
    tailor 2.22 2 2.22
    air traffic controller 2.22 2 2.22
    photographer 2.22 2 2.22
    plumber 2.22 2 2.22
    agriculturist 2.22 3 2.22
    taxi driver 2.22 1 2.22
    programmer 2.22 2 2.22
    firefighter 2.22 2 2.22
    coach 2.22 1 2.22
    chef 2.22 1 2.22
    engineer 2.22 2 2.22
    actor 2.22 2 2.22
    model 2.22 1 2.22
    scientist 2.22 1 2.22
    painter 2.22 1 2.22
    veterinary doctor 2.22 1 2.22
    cashier 2.22 4 2.22
    bartender 2.22 1 2.22
    dietician 2.22 1 2.22
    soldier 2.22 1 2.22
    journalist 2.22 1 2.22
    postman 2.22 1 2.22
    designer 2.22 1 2.22
    lawyer 2.22 1 2.22
    statistician 2.22 1 2.22
    travel agent 2.22 1 2.22
    newsreader 2.22 1 2.22
    lifeguard 2.22 1 2.22
    dental hygienist 2.22 1 2.22
    builder 2.22 3 2.22
    factory worker 2.22 4 2.22
    shop assistant 2.22 2 2.22
    pilot 2.22 2 2.22
    lecturer 2.22 1 2.22
    interpreter 2.22 1 2.22
    advocate 2.22 1 2.22
    attorney at law 2.22 1 2.22
    musician 2.22 1 2.22
    hairdresser 2.22 1 2.22
    businessman 2.22 1 2.22
    butcher 2.22 2 2.22
    librarian 2.22 3 2.22
    chemist 2.22 2 2.22
    farmer 2.22 2 2.22
    dentist 2.22 4 2.22
    writer 2.22 2 2.22
    developer 2.22 1 2.22
    accountant 2.22 2 2.22
    barber 2.22 1 2.22
    traffic warden 2.22 2 2.22
    carpenter 2.22 3 2.22
    economist 2.22 1 2.22
    bookkeeper 2.22 1 2.22
    banker 2.22 1 2.22
    astronomer 2.22 2 2.22
    judge 2.22 3 2.22
    fisherman 2.22 3 2.22
    philosopher 2.22 2 2.22
    optician 2.22 1 2.22
    translator 2.22 1 2.22
    editor 2.22 1 2.22

  • Custom User Avatar

    Error:
    total_salary
    should be 2 or less decimal places
    expected: <= 2
    got: 12

    job_title average_salary total_people total_salary
    tailor 15900.29 1 15900.29
    actor 17954.17 1 17954.17
    factory worker 19717.98 1 19717.98
    doctor 21722.36 1 21722.36
    businessman 23037.04 1 23037.04
    lawyer 27057.47 1 27057.47
    engineer 30808.39 1 30808.39
    receptionist 35000.08 1 35000.08
    secretary 39797.21 1 39797.21
    fisherman 40295.4 1 40295.4
    butcher 41223.13 1 41223.13
    gardener 41857.21 1 41857.21
    police officer 47045.42 1 47045.42
    artist 47755.41 1 47755.41
    shop assistant 27663.36 2 55326.72
    firefighter 59212.62 1 59212.62
    cashier 60425.93 1 60425.93
    air traffic controller 63211.79 1 63211.79
    attorney at law 65427.96 1 65427.96
    waiter 70950.09 1 70950.09
    bartender 71742.92 1 71742.92
    translator 73089.47 1 73089.47
    model 24517.37 3 73552.12
    statistician 76844.82 1 76844.82
    mechanic 39000.95 2 78001.91
    actress 79604.24 1 79604.24
    soldier 84446.22 1 84446.22
    programmer 85284.75 1 85284.75
    newsreader 42697.26 2 85394.52
    writer 86959.81 1 86959.81
    hairdresser 29945.77 3 89837.32
    architect 91175.88 1 91175.88
    bookkeeper 53904.55 2 107809.1
    judge 54984.5 2 109969
    coach 56126.13 2 112252.26
    nurse 57505.69 2 115011.39
    economist 61333.53 2 122667.06
    interpreter 62317.38 2 124634.77
    banker 62665.09 2 125330.17
    librarian 64190.55 2 128381.11
    traffic warden 66440.38 2 132880.77
    advocate 45191.47 3 135574.4
    optician 71266.32 2 142532.64
    teacher 71551.3 2 143102.6
    farmer 75535.01 2 151070.02
    lifeguard 52054.48 3 156163.45
    photographer 78222.95 2 156445.9
    carpenter 81509.43 2 163018.86
    biologist 54818.24 3 164454.73
    philosopher 57412.12 3 172236.38
    veterinary doctor 60126.23 3 180378.7
    dentist 46161.26 4 184645.05
    window cleaner 48197.38 4 192789.52
    builder 68239.43 3 204718.3
    dietician 69915.12 3 209745.34
    taxi driver 87674.31 4 350697.22

  • Custom User Avatar

    I think so because the query will be ran for every row, rather than once and then groupped

  • Custom User Avatar

    much cleaner solution with replace -- always forget that takes a function like a filter

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Default User Avatar

    Approved, thanks

  • Custom User Avatar
  • Custom User Avatar

    maybe the description should be updated from
    =100 = 'Miserable!'

    to
    />=100 = 'Miserable!'

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    good but you are returning the one error case, not the error itself :)

  • Custom User Avatar

    does this work for
    sssssm

    in the original that would be (1x5)-4 = 1 in your solution it would be (0x5-4) = -4

  • Custom User Avatar

    I don't think that works
    m=-5 n = 5 Math.Min(0,m,n) === 5 not 0 though zero should be returned

  • Custom User Avatar

    a+bc <= (a+b)c since c>=1
    Same true with the second expression

  • Loading more items...