harvest-worklog 0.6.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6dcc34ed6ba1cee2e39e8dea71a9b05d80fa42b598366f16332eb1676e197789
4
- data.tar.gz: 30e312eecb4f435930b74c2aa72a2a68e4f973d22f946e824bb8fee863ae8faa
3
+ metadata.gz: bd656e6ca496a7a7a5d08e0e1f407c5aaf030b80c75751abd354ce1259a3806d
4
+ data.tar.gz: cf38ac55098c083668f3df37774298c21b6329c39a6d017d1968fce9227bfd30
5
5
  SHA512:
6
- metadata.gz: fed0b9fa6998e23a607cb447e108d9849192ebdc209fc263e65ac850f19306a6430f628ccb2c5f8c9548d16d10197793ef2283e917391c2bca553aa12f7a5350
7
- data.tar.gz: 1fcb49e4868b5c8e3d5eaadd37a0c6961c5be474164a6dc5ddd346f1286e82093b6b6698e176fc95c08a92f785873d7a2e8232b8b7f723daf1a351a3d572467a
6
+ metadata.gz: 72a0dc46a8551f9f3a6e8efd7bffd6ee9a2bbaf34021f86cdd98c0dc356d08edd88e96aa0da3e992b59f7ec5794f1656f2a3c785ebf7bc002f99c6a0f06e550b
7
+ data.tar.gz: 8fae9c3ecd9f91ac43280b854715532c4ea86221a9381793fea2674800e54d4577962e7a1adc8829a545544ff6b578727aee1396f979ccc4c02c554ad68f9121
data/README.md CHANGED
@@ -77,6 +77,26 @@ Configure `projectTimeMappings` with the recorded OMP Project Time project name
77
77
 
78
78
  `harvest_preview_project_time_entries` reads the configured time log, splits sessions across local dates, generates descriptions from the project and repository, and checks Harvest for existing or locked entries without writing. `harvest_record_project_time_entries` performs the same preflight then creates only new entries; OMP treats it as a write requiring approval. Unmapped sessions are reported and never written.
79
79
 
80
+ ### Activity transforms
81
+
82
+ `harvest_preview_project_time_transforms` emits deterministic JSON for local raw intervals. It accepts an inclusive date range and optional exact `repositoryId`, `project`, and `sourceKind` filters; each matching interval is split by local date and grouped by activity, with missing labels reported as `unlabelled`. Set `applyMappings` to include configured Harvest project/task mappings. The output reports `groups`, proposed mapped `entries`, and any `unmapped` or `excluded` rows.
83
+
84
+ `harvest_record_project_time_transforms` is a separate approval-gated write step. It always applies configured mappings and records the reviewed activity entries through the existing locked and duplicate preflight. Different activity labels may share a date/project/task; rerunning the same activity label is skipped, as are locked or unrelated existing entries.
85
+
86
+ ## Reconciling WRAP hours with manual entries
87
+
88
+ Use a closed date range and record the expected OMP Project Time and manually entered hours for each day. Preview OMP entries first, then compare the final Harvest total for each day:
89
+
90
+ ```bash
91
+ harvest-worklog aggregate FROM TO \
92
+ --project WRAP \
93
+ --task Programming
94
+ ```
95
+
96
+ OMP-created entries use an `OMP Project Time:` note; use a `Manual reconciliation:` note for manual entries while testing. Inspect the Harvest entry details to distinguish their source—the aggregate intentionally combines all matching entries.
97
+
98
+ The standard work-entry importer allows only one entry for a date, project, and task. If a manual `WRAP / Programming` entry exists for a date, importing ordinary OMP Project Time for that same mapping skips it rather than adding hours. Activity transforms are the exception: distinct activity labels can create separate entries while the same label, locked entries, and unrelated manual entries are still skipped. Reconcile ordinary entries as either OMP or manual hours, not their sum.
99
+
80
100
  ## Migration from harvest-time-off
81
101
 
82
102
  Version `0.5.0` is a clean identity cutover. Uninstall the prior `harvest-time-off` gem and OMP plugin, then install `harvest-worklog`; replace former top-level CLI commands with the `harvest-worklog time-off` and `harvest-worklog work-entry` subcommands. The old package, executables, and `workEntryCommand` setting are not retained.
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module HarvestWorklog
4
- VERSION = "0.6.0"
4
+ VERSION = "0.7.0"
5
5
  end
@@ -6,7 +6,7 @@ module HarvestWorklog
6
6
  LOCKED_ENTRY = 3
7
7
 
8
8
  def self.run(arguments, output: $stdout, error: $stderr, client: nil)
9
- options = { dry_run: false }
9
+ options = { dry_run: false, activity_entry: false }
10
10
  parser = option_parser(options)
11
11
  dates = parser.parse(arguments)
12
12
  validate!(dates, options)
@@ -29,7 +29,14 @@ module HarvestWorklog
29
29
  return LOCKED_ENTRY
30
30
  end
31
31
 
32
- if existing_entries.any?
32
+ if options[:activity_entry]
33
+ activity_key = options[:notes].lines.first
34
+ unrelated_entries = existing_entries.reject { |entry| entry["notes"]&.lines&.first&.start_with?("OMP Project Time activity: ") }
35
+ if unrelated_entries.any? || existing_entries.any? { |entry| entry["notes"]&.lines&.first == activity_key }
36
+ output.puts "Existing Harvest entry on #{spent_date.iso8601}; skipped"
37
+ return EXISTING_ENTRY
38
+ end
39
+ elsif existing_entries.any?
33
40
  output.puts "Existing Harvest entry on #{spent_date.iso8601}; skipped"
34
41
  return EXISTING_ENTRY
35
42
  end
@@ -64,6 +71,7 @@ module HarvestWorklog
64
71
  opts.on("--hours HOURS", Float, "Hours for this entry") { |value| options[:hours] = value }
65
72
  opts.on("--notes NOTES", "Entry description") { |value| options[:notes] = value }
66
73
  opts.on("--dry-run", "Check for existing entries without writing") { options[:dry_run] = true }
74
+ opts.on("--activity-entry", "Allow distinct OMP Project Time activity entries on the same date, project, and task") { options[:activity_entry] = true }
67
75
  opts.on("-h", "--help", "Show this help") do
68
76
  puts opts
69
77
  exit 0
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: harvest-worklog
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marlen Brunner