Compare commits
2 Commits
8b8dd68b34
...
39d408d882
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
39d408d882 | ||
|
|
5bdde5fee1 |
54
AGENT.md
Normal file
54
AGENT.md
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
# Qwen Code Agent Configuration
|
||||||
|
|
||||||
|
This file configures the behavior and preferences for the Qwen Code agent for this specific project.
|
||||||
|
|
||||||
|
## Project Context
|
||||||
|
- **Name**: CrossFit Scheduler
|
||||||
|
- **Primary Language**: Python
|
||||||
|
- **Key Technologies**: Python scripts, JSON, Docker
|
||||||
|
- **Purpose**: Automates booking CrossFit classes based on user preferences.
|
||||||
|
|
||||||
|
## Agent Interaction Preferences
|
||||||
|
|
||||||
|
### Code Style & Conventions
|
||||||
|
- Follow PEP 8 for Python code.
|
||||||
|
- Use clear, descriptive variable and function names.
|
||||||
|
- Prefer explicit over implicit code.
|
||||||
|
- Use docstrings for modules, classes, and functions.
|
||||||
|
- Keep functions small and focused on a single task.
|
||||||
|
|
||||||
|
### Project Structure Awareness
|
||||||
|
- `main.py`: Entry point for the application.
|
||||||
|
- `execute_book_session.py`: Core logic for booking sessions.
|
||||||
|
- `preferred_sessions.json`: User preferences for session booking.
|
||||||
|
- `src/`: Directory for source code modules.
|
||||||
|
- `test_book_session.sh`: Shell script for testing session booking.
|
||||||
|
|
||||||
|
### Preferred Tools & Commands
|
||||||
|
- Use `pytest` for running tests.
|
||||||
|
- Use `docker compose` for container orchestration.
|
||||||
|
- Use `python` for running scripts.
|
||||||
|
- Refer to `requirements.txt` for dependencies.
|
||||||
|
|
||||||
|
### Communication Style
|
||||||
|
- Be concise and direct.
|
||||||
|
- Use markdown for formatting responses.
|
||||||
|
- Prioritize clarity and correctness.
|
||||||
|
- Avoid unnecessary explanations or chit-chat.
|
||||||
|
|
||||||
|
### Testing & Verification
|
||||||
|
- Always run tests after making changes.
|
||||||
|
- Use `pytest.ini` for test configuration.
|
||||||
|
- Ensure Docker containers are properly configured before running.
|
||||||
|
- Verify JSON files are correctly formatted.
|
||||||
|
|
||||||
|
### Security & Best Practices
|
||||||
|
- Never commit sensitive information like passwords or API keys.
|
||||||
|
- Use `.env` files for environment variables.
|
||||||
|
- Follow Docker best practices for containerization.
|
||||||
|
- Keep dependencies up to date.
|
||||||
|
|
||||||
|
## Custom Instructions
|
||||||
|
- When modifying `preferred_sessions.json`, ensure the structure remains valid.
|
||||||
|
- When writing shell scripts, ensure they are executable and follow best practices.
|
||||||
|
- When creating new Python files, ensure they are properly formatted and tested.
|
||||||
@@ -192,8 +192,6 @@ class Booker:
|
|||||||
|
|
||||||
# Parse TARGET_RESERVATION_TIME to get the target hour and minute
|
# Parse TARGET_RESERVATION_TIME to get the target hour and minute
|
||||||
target_hour, target_minute = map(int, TARGET_RESERVATION_TIME.split(":"))
|
target_hour, target_minute = map(int, TARGET_RESERVATION_TIME.split(":"))
|
||||||
target_time = datetime.now(tz).replace(hour=target_hour, minute=target_minute, second=0, microsecond=0)
|
|
||||||
booking_window_end = target_time + timedelta(minutes=BOOKING_WINDOW_END_DELTA_MINUTES)
|
|
||||||
|
|
||||||
# Initial login
|
# Initial login
|
||||||
if not self.auth_handler.login():
|
if not self.auth_handler.login():
|
||||||
@@ -206,15 +204,19 @@ class Booker:
|
|||||||
current_time: datetime = datetime.now(tz)
|
current_time: datetime = datetime.now(tz)
|
||||||
logging.info(f"Current time: {current_time}")
|
logging.info(f"Current time: {current_time}")
|
||||||
|
|
||||||
|
# Recalculate target time and end time for the current day
|
||||||
|
today_target_time = current_time.replace(hour=target_hour, minute=target_minute, second=0, microsecond=0)
|
||||||
|
booking_window_end = today_target_time + timedelta(minutes=BOOKING_WINDOW_END_DELTA_MINUTES)
|
||||||
|
|
||||||
# Only book sessions if current time is within the booking window
|
# Only book sessions if current time is within the booking window
|
||||||
if target_time <= current_time <= booking_window_end:
|
if today_target_time <= current_time <= booking_window_end:
|
||||||
# Run booking cycle to check for preferred sessions and book
|
# Run booking cycle to check for preferred sessions and book
|
||||||
await self.booker(current_time)
|
await self.booker(current_time)
|
||||||
# Wait for a short time before next check
|
# Wait for a short time before next check
|
||||||
time.sleep(60)
|
time.sleep(60)
|
||||||
else:
|
else:
|
||||||
# Display message when outside booking window
|
# Display message when outside booking window
|
||||||
# logging.info(f"Not booking now - current time {current_time} is outside the booking window ({target_time} to {booking_window_end})")
|
# logging.info(f"Not booking now - current time {current_time} is outside the booking window ({today_target_time} to {booking_window_end})")
|
||||||
# Check again in 5 minutes if outside booking window
|
# Check again in 5 minutes if outside booking window
|
||||||
time.sleep(300)
|
time.sleep(300)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|||||||
Reference in New Issue
Block a user