{"id":22154051,"url":"https://github.com/jankaritech/openprojecttmetricintegration","last_synced_at":"2025-08-16T11:42:27.474Z","repository":{"id":262240732,"uuid":"879693480","full_name":"JankariTech/OpenProjectTmetricIntegration","owner":"JankariTech","description":"Tool to sync time entries between tmetric and OpenProject","archived":false,"fork":false,"pushed_at":"2025-02-18T04:29:24.000Z","size":103,"stargazers_count":0,"open_issues_count":4,"forks_count":1,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-03-22T21:15:37.096Z","etag":null,"topics":["openproject","time-tracker","tmetric"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/JankariTech.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-10-28T11:39:38.000Z","updated_at":"2024-12-11T03:50:31.000Z","dependencies_parsed_at":"2024-11-11T11:39:41.036Z","dependency_job_id":"b8957a5b-4e29-4c77-896e-08684e42543c","html_url":"https://github.com/JankariTech/OpenProjectTmetricIntegration","commit_stats":null,"previous_names":["jankaritech/openprojecttmetricintegration"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JankariTech%2FOpenProjectTmetricIntegration","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JankariTech%2FOpenProjectTmetricIntegration/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JankariTech%2FOpenProjectTmetricIntegration/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JankariTech%2FOpenProjectTmetricIntegration/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JankariTech","download_url":"https://codeload.github.com/JankariTech/OpenProjectTmetricIntegration/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245284727,"owners_count":20590307,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["openproject","time-tracker","tmetric"],"created_at":"2024-12-02T01:39:58.620Z","updated_at":"2025-08-16T11:42:27.449Z","avatar_url":"https://github.com/JankariTech.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Preparation\n## As the admin\nThere are some steps that need to be done as the tmetric admin and the OpenProject admin.\n\n### tmetric\n- get the client ID by selecting the client, whose data you want to sync with OpenProject, from Manage-\u003eClients and copying the last number from the URL. For example, if the URL is `https://app.tmetric.com/#/account/12345/clients/67890`, the client ID is `67890`.\n- create a dummy project. You can give it any name you like. No time will be logged to this project, but it's needed to create links to OpenProject.\n- get the ID of the dummy project. For example, if the URL is `https://app.tmetric.com/#/account/12345/projects/989898` the project ID is `989898`.\n- create work types. The names of the Work Types **must match** the names of the time tracking activities in OpenProject.\n- assign the work types to the project which data you want to sync to OpenProject.\n- create a tag called `transferred-to-openproject`. This tag will be used to mark time entries that have been transferred to OpenProject.\n\n### OpenProject\n- enable the 'Time and costs' module for the projects you want to sync with tmetric\n\n## As the user\n### get tokens\n#### OpenProject\n- go to your profile (by clicking on your avatar in the top right corner)\n- click on `My account`\n- click on `Access tokens`\n- click on `+ API token`\n- give the token a name and click on `Create`\n- copy the token\n\n#### t-metric\n- go to your profile (by clicking on your avatar in the top right corner)\n- click on `Profile Settings`\n- click on `Get new API token`\n- copy the token\n\n### configure\n\nin your home folder create a file called `.OpenProjectTmetricIntegration.yaml` with the following content (enter your tokens):\n\n```yaml\nopenproject:\n  url: 'https://community.openproject.org'\n  token: \u003copenproject token\u003e\ntmetric:\n  token: \u003ct-metric token\u003e\n  clientId: \u003cid of the client in tmetric\u003e\n  dummyProjectId: \u003cid of the dummy project the admin created\u003e\n```\n\n### run\n\n#### check and fix the time entries in tmetric\n```bash\ngo run main.go check tmetric\n```\n\nThe tool with show you any invalid or inconsistent time entries and ask you for data to fix them.\nThis step will only adjust data on tmetric, no data will be written to OpenProject.\n\n#### transfer the time entries to OpenProject\n```bash\ngo run main.go copy\n```\n\nThis will copy the time entries from tmetric to OpenProject. The time entries will be marked with the tag `transferred-to-openproject` in tmetric. Any entry that already has this tag will be skipped.\n\n#### validate if the data in tmetric and OpenProject is consistent\n```bash\ngo run main.go diff\n```\nThis will show you a table with the time entries in both systems and if there is any difference in the logged time per day. Check if the data is correct.\n\n1. If some data is in tmetric but not in OpenProject, run the `copy` command again.\n2. If some data is in OpenProject but not in tmetric, delete or edit it in OpenProject. To do so use the [cost-report feature](https://www.openproject.org/docs/user-guide/time-and-costs/reporting/).\n3. If you want to sync data again from tmetric to OpenProject, remove the `transferred-to-openproject` tag from the time entries in tmetric. **This will create new entries in OpenProject and by that might lead to duplication.**\n\n#### export data\nData can be exported using the [Go template system](https://pkg.go.dev/text/template). This is useful e.g. to generate an invoice.\nFirst create a template file and then run:\n    \n```bash\ngo run main.go export --template template.tmpl\n```\n\n- **DetailedReport** with parameters: `clientName string, tagName string, groupName string`. Gets a detailed report from t-metric and returns a `tmetric.Report` object.\n- **AllWorkTypes**. Gets all possible work types from t-metric and returns an array of `tmetric.Tag`\n- **AllTeams**. Gets all teams from t-metric and returns an array of `tmetric.Team`\n- **ServiceDate**. Returns the month of the `--start` date for the export in the format `01/2006`\n- **AllTimeEntriesFromOpenProject** with parameter `user string`. Gets all time entries for that user from OpenProject and returns an array of `openproject.TimeEntry`\n- **ArbitraryString** with parameter `i int`. Gets the data of the `arbitraryString` command line flag. Useful e.g. to add an invoice number.\n- **formatFloat** with parameters `f float64, decimalSeparator string (optional)`. Formats the float value to `%.2f` with that given separator.\n- all functions from [spring](https://masterminds.github.io/sprig/)\n\n#### work for a specific time period\nBy default, the script will work with the current calendar month, but the start and end date can be configured with the `--start` and `--end` flags. The date format is `YYYY-MM-DD`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjankaritech%2Fopenprojecttmetricintegration","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjankaritech%2Fopenprojecttmetricintegration","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjankaritech%2Fopenprojecttmetricintegration/lists"}