Closed johannesjh closed 1 year ago
This is an excellent idea, thank you very much. And I have good news. I am currently working on a complete rewrite on Insect. One of the key new features is that users are able to define units on their own (see unit
keyword below, and ignore the additional dimension
definition for now... this might not be mandatory in the future). I translated your pseudo Insect code to actual Insect-new code:
And this program correctly prints what you expected:
500.000000 workday
300.000000 workday
5.000000 FTE
(yeah, I need to work on the output formatting)
The bad news is that this new version is quite far from feature parity with the current version, so this will take some time until I can release it.
In the meantime, we could certainly think about introducing this to the current version somehow, but hard-coding those units (e.g. workday = 8 workhours
) seems a bit strange.
Hi! Thank you, these are great news regarding the rewrite!! (note about the custom dimensions, sympy seems to have a similar separation between units and their underlying dimensions... and yes, I also think that workhours are best represented in a different dimension than regular time).
In the meantime, a minimal change would be to only introduce a single, hardcoded dummy unit, either workhour
or workday
. This would enable all of the above calculations without hardcoding any country- or project-dependant stuff. This change would add a single line of code, similar to Q.workhour ==> ["workhour", "workhours", "manhour", "manhours"]
, right? Would you accept this as PR - or be so kind to implement it yourself, since I have never programmed in purescript yet?
thank you and best regards, Johannes
In the meantime, a minimal change would be to only introduce a single, hardcoded dummy unit, either
workhour
orworkday
. This would enable all of the above calculations without hardcoding any country- or project-dependant stuff.
I don't think that works. We do have "dummy" units like this, see: https://github.com/sharkdp/insect/issues/136#issuecomment-362827365. We could abuse e.g. piece
to mean "workhour". But then this happens:
That is correct, but we can not convert to workdays, because that is not a proper unit:
result ➞ workday
= 4000 piece
As a workaround, you can do
result / workday
= 500
which yields the desired result. But it's a bit unsatisfactory.
This change would add a single line of code, similar to
Q.workhour ==> ["workhour", "workhours", "manhour", "manhours"]
, right?
There is a bit more work involved in a dependency: https://github.com/sharkdp/purescript-quantities — but following what we do for e.g. "piece" or "person" should work.
@johannesjh You can now play with this online: https://numbat.dev/ (I added your code as an example Numbat program here: https://github.com/sharkdp/numbat/blob/master/examples/workhours.nbt)
This is awesome, thank you, great work on numbat!! (I think we can close this issue, thank you so much!!!)
I would love to use insect.sh for calculating project efforts using workhours (aka man-hours, person-hours, and its derivatives such as person-days, person-years, fulltime equivalents etc) . Could you add a dummy unit for this purpose? (or a way to define custom units?)
Background: Compare wikipedia https://en.wikipedia.org/wiki/Man-hour
Feature Request: The smallest possible change would be to add a new unit
workhour
, similar to the other dummy units from #136.Motivation: This would enable calculations such as the following examples