Conversation
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
eu sem querer fiz as ultimas alterações na main ao invés da branch da feature
There was a problem hiding this comment.
Pull request overview
This PR implements a complete feature for creating and managing class-specific assessment goals (metas) within the Teaching Assistant system. The implementation includes:
- Frontend: Added a modal interface in the Classes component for adding and managing metas, with improved accessibility for modal close buttons
- Backend: Significant refactoring of the
ClassandClassesmodels to encapsulate metas logic, validation, and persistence, removing business logic from the controller - Testing: Comprehensive E2E test coverage using Cucumber for both GUI and API interactions
Reviewed changes
Copilot reviewed 19 out of 21 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| server/src/server.ts | Added new API endpoints (GET/POST) for managing class metas and updated class creation/loading to support metas |
| server/src/models/Classes.ts | Added methods for retrieving and adding metas to classes |
| server/src/models/Class.ts | Major refactoring: added metas properties, validation logic, locking mechanism, and updated serialization |
| server/data/app-data.json | Updated test data with metas fields and simplified enrollment data |
| client/src/types/Class.ts | Added metas and metasLocked properties to Class interface |
| client/src/step-definitions/student-steps.ts | Refactored to use shared setup scope for browser/page management |
| client/src/step-definitions/setup.ts | New shared setup file for Cucumber test configuration |
| client/src/step-definitions/server-student-steps.ts | Commented out duplicate timeout setting |
| client/src/step-definitions/server-criacao-metas.steps.ts | New E2E tests for server-side metas API |
| client/src/step-definitions/criacao-metas.steps.ts | New E2E tests for GUI-based metas management |
| client/src/services/ClassService.ts | Added setMetas method and updated type usage |
| client/src/features/server-criacao-metas.feature | Feature file defining server-side metas scenarios |
| client/src/features/criacao-metas.feature | Feature file defining GUI metas scenarios |
| client/src/components/Evaluations.tsx | Updated to use class-specific metas instead of hardcoded goals |
| client/src/components/Classes.tsx | Added metas modal UI and management logic |
| client/src/App.tsx | Added success message state and handler |
| client/src/App.css | Added styles for metas UI components and success messages |
| client/package.json | Updated Cucumber version and added type definitions |
| client/cucumber.js | Added TS_NODE_PROJECT environment variable |
Files not reviewed (1)
- client/package-lock.json: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| const isLocked = data.metasLocked !== undefined | ||
| ? data.metasLocked | ||
| : (data.metas && data.metas.length > 0); |
There was a problem hiding this comment.
The fallback logic (data.metas && data.metas.length > 0) for determining lock status could lead to incorrect behavior. If metasLocked is explicitly set to false but metas exist, this fallback won't be used. Consider using data.metasLocked ?? (data.metas && data.metas.length > 0) to only apply the fallback when the property is actually undefined.
| const isLocked = data.metasLocked !== undefined | |
| ? data.metasLocked | |
| : (data.metas && data.metas.length > 0); | |
| const isLocked = data.metasLocked ?? (data.metas && data.metas.length > 0); |
| "Requisitos", | ||
| "Testes de software" | ||
| ], | ||
| "metasLocked": false, |
There was a problem hiding this comment.
The test data shows metasLocked: false when metas exist (lines 29-32). This contradicts the business logic in Class.ts where setMetas automatically sets metasLocked to true. Test data should reflect the actual system behavior.
| "metasLocked": false, | |
| "metasLocked": true, |
| await scope.page.waitForSelector(SELECTORS.metaInput, { timeout: 1500 }); | ||
| await scope.page.click(SELECTORS.metaInput, { clickCount: 3 }); | ||
| await scope.page.focus(SELECTORS.metaInput); | ||
| await scope.page.keyboard.down('Control'); await scope.page.keyboard.press('A'); await scope.page.keyboard.up('Control'); |
There was a problem hiding this comment.
The keyboard combination for text selection is hard-coded for Control+A, which won't work on macOS where Command+A is used. Consider using a cross-platform approach or detecting the operating system.
| await scope.page.keyboard.down('Control'); await scope.page.keyboard.press('A'); await scope.page.keyboard.up('Control'); | |
| if (process.platform === 'darwin') { | |
| await scope.page.keyboard.down('Meta'); await scope.page.keyboard.press('A'); await scope.page.keyboard.up('Meta'); | |
| } else { | |
| await scope.page.keyboard.down('Control'); await scope.page.keyboard.press('A'); await scope.page.keyboard.up('Control'); | |
| } |
| const data = await ClassService.setMetas(classObj.id, localMetas); | ||
|
|
||
| // Show server message if provided | ||
| const serverMessage = data && (data.message || data.msg) ? (data.message || data.msg) : 'Metas criadas com sucesso!'; |
There was a problem hiding this comment.
The fallback message is in Portuguese while many other parts of the UI are in English (e.g., 'Close', 'Edit', 'Delete'). Consider using consistent language throughout the application or providing internationalization support.
| const serverMessage = data && (data.message || data.msg) ? (data.message || data.msg) : 'Metas criadas com sucesso!'; | |
| const serverMessage = data && (data.message || data.msg) ? (data.message || data.msg) : 'Goals created successfully!'; |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
eu nao fiz as alteracoes na branch necessaria
Pull Request - Teaching Assistant
📝 Descrição
O que foi feito:
Implementação completa da funcionalidade de Criação e Manutenção de Metas de Avaliação por turma.
ClasseClassespara encapsular a lógica de metas, validação e persistência, removendo lógica de negócio do controlador (server.ts).Por que foi feito:
Para permitir que cada turma tenha seus próprios critérios de avaliação (metas) de forma independente, flexibilizando o sistema que antes não suportava essa personalização. Além disso, a refatoração foi necessária para garantir a integridade dos dados (evitando o uso de
anye garantindo o estado de "bloqueio" das metas após a criação).📌 Observações
Impacto:
Riscos identificados:
fromJSONcom lógica de fallback).📦 Área afetada
Frontend (Client - React):
Classes.tsx)Backend (Server - Express/Node.js):
Class.ts,Classes.ts)Funcionalidades:
Infraestrutura:
cucumber.js,tsconfig.test.json)🔧 Tipo de mudança
Class.tse remoção deany)🧪 Testes
Testes automatizados
Por nível de teste:
Class.tsPor área testada:
Cobertura:
Como revisar e testar
Testes Unitários (Server):
Testes E2E (Client):
Testar manualmente:
http://localhost:3000http://localhost:3004📸 Screenshots/GIFs
✅ Checklist
🔗 Issues relacionadas