Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
7539164
increase the memory limit to prevent crashing during build time.
MRNafisiA May 2, 2025
62548e5
feat(task-drawer): add recurring task configuration
chamikaJ May 14, 2025
d333104
feat(i18n): add recurring task translation keys
chamikaJ May 16, 2025
ebd0f66
feat(task-drawer): integrate socket handling for recurring task updates
chamikaJ May 16, 2025
753e3be
Merge pull request #131 from chamikaJ/feature/recurring-tasks
chamikaJ May 16, 2025
8e74f1d
Merge branch 'chore/add-google-analytics' of https://github.com/Workl…
chamikaJ May 16, 2025
2e985bd
feat(recurring-tasks): implement recurring task scheduling and API in…
chamikaJ May 16, 2025
49bdd00
fix(todo-list): update empty list image source to use relative path
chamikaJ May 16, 2025
f3a7fd8
refactor(project-view): optimize component with useMemo and useCallba…
chamikaJ May 18, 2025
f9858fb
refactor(task-list): enhance performance with useMemo and useCallback
chamikaJ May 18, 2025
69b910f
refactor(sql-functions): enhance SQL functions with COALESCE for bett…
chamikaJ May 19, 2025
82155ca
docs: add user guide and cron job documentation for recurring tasks
chamikaJ May 19, 2025
c19e06d
refactor: enhance task completion ratio calculation and reporting
chamikaJ May 19, 2025
fc30c18
feat(reporting): add support for 'all time' date range in reporting a…
chamikaJ May 19, 2025
a568ee8
Merge branch 'feature/member-time-progress-and-utilization' of https:…
chamikaJ May 19, 2025
84c7428
feat(recurring-tasks): enhance recurring task functionality and docum…
chamikaJ May 21, 2025
cef4bff
Update README.md
chamikaJ May 21, 2025
7e431d6
Merge pull request #134 from Worklenz/chamikaJ-patch-1
chamikaJ May 21, 2025
0cb0efe
feat(cron-jobs): conditionally enable recurring tasks based on enviro…
chamikaJ May 21, 2025
2bdae40
feat(hubspot-integration): add HubSpot script component for productio…
chamikaJ May 21, 2025
4687478
fix: update empty list image source to use S3 URL for consistency acr…
chamikaJ May 21, 2025
8704b6a
style: adjust font-family formatting and add styles for HubSpot chat …
chamikaJ May 21, 2025
d7ca1d8
style: remove HubSpot chat widget styles from global CSS
chamikaJ May 21, 2025
f716971
feat(hubspot-integration): dynamically load HubSpot script in product…
chamikaJ May 21, 2025
c1e923c
feat(ownership-transfer): implement transfer_team_ownership function …
chamikaJ May 21, 2025
c18889a
refactor(task-drawer): remove unused imports and add edit mode for ta…
chamikaJ May 22, 2025
80797e0
Merge branch 'development' of https://github.com/Worklenz/worklenz in…
chamikaJ May 27, 2025
32248f8
Update README.md to include video guides for local and remote deployment
kithmina1999 May 28, 2025
3a39b25
Merge pull request #144 from kithmina1999/docs/add-video-guides
chamikaJ May 28, 2025
102be2c
Generate random passwords in update-docker-env.sh
gdevenyi May 28, 2025
3de4f69
Merge pull request #142 from gdevenyi/patch-2
chamikaJ May 30, 2025
f4ab784
Merge pull request #105 from MRNafisiA/main
chamikaJ May 30, 2025
f38a7b4
Merge branch 'feature/recurring-tasks' of https://github.com/Worklenz…
chamikaJ May 30, 2025
65af5f6
refactor(build): remove Gruntfile and transition to npm scripts for b…
chamikaJ May 30, 2025
6ffdbc6
refactor(navbar): comment out license expiry alert for future impleme…
chamikaJ May 30, 2025
837692e
feat(task-list): implement optimized task group handling and filter d…
chamikaJ May 30, 2025
5e4d78c
refactor(task-details-form): enhance progress input handling and impr…
chamikaJ Jun 2, 2025
24fa837
feat(auth): enhance login and verification processes with detailed de…
chamikaJ Jun 2, 2025
69f5009
refactor(auth): remove debug logging and enhance session middleware
chamikaJ Jun 2, 2025
cfa0af2
refactor(session-middleware): improve cookie handling and security se…
chamikaJ Jun 2, 2025
09f44a5
fix: change DB_PASSWORD to static value for development
kithmina1999 Jun 5, 2025
bd77733
feat(timers): add running timers feature to the navbar
chamikaJ Jun 5, 2025
6002ab7
refactor(task-list): optimize selector usage and update component pro…
chamikaJ Jun 5, 2025
323b171
Merge pull request #148 from kithmina1999/fix/postgres-password-auth
chamikaJ Jun 5, 2025
2de9b7f
Merge branch 'Worklenz:main' into fix/kanban-board-optimization
shancds Jun 6, 2025
1583221
fix: enable automatic refetching for task queries in dropdown and dat…
shancds Jun 6, 2025
926c058
Merge pull request #149 from shancds/fix/home-task-list-status-update
chamikaJ Jun 6, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<h1 align="center">
<a href="https://worklenz.com" target="_blank" rel="noopener noreferrer">
<img src="https://app.worklenz.com/assets/icons/icon-144x144.png" alt="Worklenz Logo" width="75">
<img src="https://s3.us-west-2.amazonaws.com/worklenz.com/assets/icon-144x144.png" alt="Worklenz Logo" width="75">
</a>
<br>
Worklenz
Expand Down Expand Up @@ -315,6 +315,7 @@ docker-compose up -d
docker-compose down
```


## MinIO Integration

The project uses MinIO as an S3-compatible object storage service, which provides an open-source alternative to AWS S3 for development and production.
Expand Down Expand Up @@ -403,6 +404,10 @@ This script generates properly configured environment files for both development
- Frontend: http://localhost:5000
- Backend API: http://localhost:3000 (or https://localhost:3000 with SSL)

4. Video Guide

For a visual walkthrough of the local Docker deployment process, check out our [step-by-step video guide](https://www.youtube.com/watch?v=AfwAKxJbqLg).

### Remote Server Deployment

When deploying to a remote server:
Expand All @@ -428,6 +433,10 @@ When deploying to a remote server:
- Frontend: http://your-server-hostname:5000
- Backend API: http://your-server-hostname:3000

4. Video Guide

For a complete walkthrough of deploying Worklenz to a remote server, check out our [deployment video guide](https://www.youtube.com/watch?v=CAZGu2iOXQs&t=10s).

### Environment Configuration

The Docker setup uses environment variables to configure the services:
Expand Down
60 changes: 60 additions & 0 deletions docs/recurring-tasks-user-guide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Recurring Tasks: User Guide

## What Are Recurring Tasks?
Recurring tasks are tasks that repeat automatically on a schedule you choose. This helps you save time and ensures important work is never forgotten. For example, you can set up a recurring task for weekly team meetings, monthly reports, or daily check-ins.

## Why Use Recurring Tasks?
- **Save time:** No need to create the same task over and over.
- **Stay organized:** Tasks appear automatically when needed.
- **Never miss a deadline:** Tasks are created on time, every time.

## How to Set Up a Recurring Task
1. Go to the tasks section in your workspace.
2. Choose to create a new task and look for the option to make it recurring.
3. Fill in the task details (name, description, assignees, etc.).
4. Select your preferred schedule (see options below).
5. Save the task. It will now be created automatically based on your chosen schedule.

## Schedule Options
You can choose how often your task repeats. Here are the available options:

- **Daily:** The task is created every day.
- **Weekly:** The task is created once a week. You can pick one or more days (e.g., every Monday and Thursday).
- **Monthly:** The task is created once a month. You have two options:
- **On a specific date:** Choose a date from 1 to 28 (limited to 28 to ensure consistency across all months)
- **On a specific day:** Choose a week (first, second, third, fourth, or last) and a day of the week
- **Every X Days:** The task is created every specified number of days (e.g., every 3 days)
- **Every X Weeks:** The task is created every specified number of weeks (e.g., every 2 weeks)
- **Every X Months:** The task is created every specified number of months (e.g., every 3 months)

### Examples
- "Send team update" every Friday (weekly)
- "Submit expense report" on the 15th of each month (monthly, specific date)
- "Monthly team meeting" on the first Monday of each month (monthly, specific day)
- "Check backups" every day (daily)
- "Review project status" every Monday and Thursday (weekly, multiple days)
- "Quarterly report" every 3 months (every X months)

## Future Task Creation
The system automatically creates tasks up to a certain point in the future to ensure timely scheduling:

- **Daily Tasks:** Created up to 7 days in advance
- **Weekly Tasks:** Created up to 2 weeks in advance
- **Monthly Tasks:** Created up to 2 months in advance
- **Every X Days/Weeks/Months:** Created up to 2 intervals in advance

This ensures that:
- You always have upcoming tasks visible in your schedule
- Tasks are created at appropriate intervals
- The system maintains a reasonable number of future tasks

## Tips
- You can edit or stop a recurring task at any time.
- Assign team members and labels to recurring tasks for better organization.
- Check your task list regularly to see newly created recurring tasks.
- For monthly tasks, dates are limited to 1-28 to ensure the task occurs on the same date every month.
- Tasks are created automatically within the future limit window - you don't need to manually create them.
- If you need to see tasks further in the future, they will be created automatically as the current tasks are completed.

## Need Help?
If you have questions or need help setting up recurring tasks, contact your workspace admin or support team.
104 changes: 104 additions & 0 deletions docs/recurring-tasks.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
# Recurring Tasks Cron Job Documentation

## Overview
The recurring tasks cron job automates the creation of tasks based on predefined templates and schedules. It ensures that tasks are generated at the correct intervals without manual intervention, supporting efficient project management and timely task assignment.

## Purpose
- Automatically create tasks according to recurring schedules defined in the database.
- Prevent duplicate task creation for the same schedule and date.
- Assign team members and labels to newly created tasks as specified in the template.

## Scheduling Logic
- The cron job is scheduled using the [cron](https://www.npmjs.com/package/cron) package.
- The schedule is defined by a cron expression (e.g., `*/2 * * * *` for every 2 minutes, or `0 11 */1 * 1-5` for 11:00 UTC on weekdays).
- On each tick, the job:
1. Fetches all recurring task templates and their schedules.
2. Determines the next occurrence for each template using `calculateNextEndDate`.
3. Checks if a task for the next occurrence already exists.
4. Creates a new task if it does not exist and the next occurrence is within the allowed future window.

## Future Limit Logic
The system implements different future limits based on the schedule type to maintain an appropriate number of future tasks:

```typescript
const FUTURE_LIMITS = {
daily: moment.duration(7, 'days'),
weekly: moment.duration(2, 'weeks'),
monthly: moment.duration(2, 'months'),
every_x_days: (interval: number) => moment.duration(interval * 2, 'days'),
every_x_weeks: (interval: number) => moment.duration(interval * 2, 'weeks'),
every_x_months: (interval: number) => moment.duration(interval * 2, 'months')
};
```

### Implementation Details
- **Base Calculation:**
```typescript
const futureLimit = moment(template.last_checked_at || template.created_at)
.add(getFutureLimit(schedule.schedule_type, schedule.interval), 'days');
```

- **Task Creation Rules:**
1. Only create tasks if the next occurrence is before the future limit
2. Skip creation if a task already exists for that date
3. Update `last_checked_at` after processing

- **Benefits:**
- Prevents excessive task creation
- Maintains system performance
- Ensures timely task visibility
- Allows for schedule modifications

## Date Handling
- **Monthly Tasks:**
- Dates are limited to 1-28 to ensure consistency across all months
- This prevents issues with months having different numbers of days
- No special handling needed for February or months with 30/31 days
- **Weekly Tasks:**
- Supports multiple days of the week (0-6, where 0 is Sunday)
- Tasks are created for each selected day
- **Interval-based Tasks:**
- Every X days/weeks/months from the last task's end date
- Minimum interval is 1 day/week/month
- No maximum limit, but tasks are only created up to the future limit

## Database Interactions
- **Templates and Schedules:**
- Templates are stored in `task_recurring_templates`.
- Schedules are stored in `task_recurring_schedules`.
- The job joins these tables to get all necessary data for task creation.
- **Task Creation:**
- Uses a stored procedure `create_quick_task` to insert new tasks.
- Assigns team members and labels by calling appropriate functions/controllers.
- **State Tracking:**
- Updates `last_checked_at` and `last_created_task_end_date` in the schedule after processing.
- Maintains future limits based on schedule type.

## Task Creation Process
1. **Fetch Templates:** Retrieve all templates and their associated schedules.
2. **Determine Next Occurrence:** Use the last task's end date or the schedule's creation date to calculate the next due date.
3. **Check for Existing Task:** Ensure no duplicate task is created for the same schedule and date.
4. **Create Task:**
- Insert the new task using the template's data.
- Assign team members and labels as specified.
5. **Update Schedule:** Record the last checked and created dates for accurate future runs.

## Configuration & Extension Points
- **Cron Expression:** Modify the `TIME` constant in the code to change the schedule.
- **Task Template Structure:** Extend the template or schedule interfaces to support additional fields.
- **Task Creation Logic:** Customize the task creation process or add new assignment/labeling logic as needed.
- **Future Window:** Adjust the future limits by modifying the `FUTURE_LIMITS` configuration.

## Error Handling
- Errors are logged using the `log_error` utility.
- The job continues processing other templates even if one fails.
- Failed task creations are not retried automatically.

## References
- Source: `src/cron_jobs/recurring-tasks.ts`
- Utilities: `src/shared/utils.ts`
- Database: `src/config/db.ts`
- Controllers: `src/controllers/tasks-controller.ts`

---
For further customization or troubleshooting, refer to the source code and update the documentation as needed.
8 changes: 4 additions & 4 deletions update-docker-env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ cat > worklenz-backend/.env << EOL
NODE_ENV=production
PORT=3000
SESSION_NAME=worklenz.sid
SESSION_SECRET=change_me_in_production
COOKIE_SECRET=change_me_in_production
SESSION_SECRET=$(openssl rand -base64 48)
COOKIE_SECRET=$(openssl rand -base64 48)

# CORS
SOCKET_IO_CORS=${FRONTEND_URL}
Expand Down Expand Up @@ -123,7 +123,7 @@ SLACK_WEBHOOK=
COMMIT_BUILD_IMMEDIATELY=true

# JWT Secret
JWT_SECRET=change_me_in_production
JWT_SECRET=$(openssl rand -base64 48)
EOL

echo "Environment configuration updated for ${HOSTNAME} with" $([ "$USE_SSL" = "true" ] && echo "HTTPS/WSS" || echo "HTTP/WS")
Expand All @@ -138,4 +138,4 @@ echo "Frontend URL: ${FRONTEND_URL}"
echo "API URL: ${HTTP_PREFIX}${HOSTNAME}:3000"
echo "Socket URL: ${WS_PREFIX}${HOSTNAME}:3000"
echo "MinIO Dashboard URL: ${MINIO_DASHBOARD_URL}"
echo "CORS is configured to allow requests from: ${FRONTEND_URL}"
echo "CORS is configured to allow requests from: ${FRONTEND_URL}"
6 changes: 5 additions & 1 deletion worklenz-backend/.env.template
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,8 @@ GOOGLE_CAPTCHA_SECRET_KEY=your_captcha_secret_key
GOOGLE_CAPTCHA_PASS_SCORE=0.8

# Email Cronjobs
ENABLE_EMAIL_CRONJOBS=true
ENABLE_EMAIL_CRONJOBS=true

# RECURRING_JOBS
ENABLE_RECURRING_JOBS=true
RECURRING_JOBS_INTERVAL="0 11 */1 * 1-5"
131 changes: 0 additions & 131 deletions worklenz-backend/Gruntfile.js

This file was deleted.

Loading