Comments (3)
That sounds like an interesting feature! I could have used it with my previous employers as well. I would more than happy to merge a PR for it. So, please go ahead. Currently, I don't have planned any refactoring that could conflict with the implementation.
from bartib.
Working on it, but I'm running into issues with the way we now pass referenced Activities around.
My idea is as follows:
Right after reading getter::get_activities()
we process them. For now, that processing would only be rounding, with a round_activity(&Activity, round: Duration) -> Activity
. round_activity
returns a new Activity, but with start and end(optional) rounded to nearest Duration
. ยน
Processing Activities this early, has as advantage that any calculation, or filter, that follows, uses the rounded values. This way we avoid e.g. filtering for up to 14:15 to e.g. include a entry with, say, end=14:12, but where the rounded value then would show 14:30. That would be weird, not?
Same for calculations, e.g. the totals: they should, IMO, be the sum of the rounded values. Not all values summed and then rounded.
The downside of my approach is that in the current code, all filters, processors, views etc, operate on &'a [&'a Activity]
, not &'a [Activity]
. So the change would be rather big: I'd need to refactor all the references to become values. What do you think of this?
ยน Or better: the issue is that I'm not experienced enough in Rust to find a way to return a referenced Activity that isn't the original Activity
from bartib.
Your approach sounds reasonable to me. Incorporating a processing step in the reporting and list commands could also help us with issue #29.
Changing the other functions to work on moved values rather than on borrowed values appears to be a significant change. However, at this moment I don't see what would speak against it.
from bartib.
Related Issues (20)
- Report tasks over midnight HOT 2
- My starship config for bartib. HOT 2
- feature request: Ability to mark, archive or tag entries. HOT 7
- Integration with 3rd party services like Toggl HOT 1
- What does "bartib" mean, if anything? HOT 3
- Unquote output of bartib projects? HOT 3
- Allow for a default command, or make start the default? HOT 1
- Enhance error message HOT 1
- Broken link HOT 1
- Configure (or remove) leader lines? HOT 3
- `export` command or `csv` as a save file format for activities HOT 1
- `break` command: recording break times HOT 1
- `report` command: Use `wildmatch` for matching projects in reports
- `generate`/`gen`/`completions` command: Generate shell completions HOT 1
- Refactor to abscissa microframework for Rust applications HOT 2
- Make `--project`/`-p` be able to be used multiple times on `report` to add projects to the filter
- [Bug] Problem with defining log file HOT 11
- Collab HOT 4
- Add example of usage in -h HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bartib.