cannawen / metric_units_reddit_bot

Reddit bot converting imperial units to metric units
https://www.reddit.com/user/metric_units
GNU General Public License v3.0
78 stars 34 forks source link

Add conversion support for troy ounces #35

Closed eliotw closed 6 years ago

cannawen commented 6 years ago

Hey, the Troy ounce conversion looks good, but in certain subreddits they will just refer to them as "ounces" (see enhancement requirement point 2 in #30).

Do you want to write code to process "oz" as "Troy oz" in some subreddits? If you don't feel like it, I can break that requirement out into a separate issue and accept this PR as is :) Thanks!

eliotw commented 6 years ago

Ah missed that. I will take a look at it and update the request.

eliotw commented 6 years ago

Hi @cannawen, I took a quick look. I read your suggestion in the original issue about preprocessing the input to convert 'ounces' to 'troy ounces' when appropriate. However, I don't think that can be accomplished currently because only the input string is available there. Seems like the comment's subreddit would need to be available when preprocessing the inputs, or some how associating a list of imperial units with some subreddits. Thoughts?

cannawen commented 6 years ago

Yes, good point. It would need a bit of a refactor (pass in a comment obejct to the preprocess instead of the comment[body]. The comment object should contain the subreddit)

eliotw commented 6 years ago

Hi @cannawen, updated the PR to include the refactor to preprocess. Please review when you have a chance.

cannawen commented 6 years ago

Woohoo! It'll be deployed in the next release, v0.11.7 :) Thank you for your help!!