Spaces:
Sleeping
Sleeping
Add writing tasks support
Browse files- Add complete writing tasks functionality with email and survey response tasks
- Fix task type mapping to match database schema
- Update data loading to include writing tasks from Supabase
- Update package version to 0.0.4
- Clean up unnecessary code comments
- RELEASE_NOTES.md +16 -0
- package.json +1 -1
- src/pages/index.astro +40 -6
- src/utils/loadData.ts +0 -5
RELEASE_NOTES.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
| 1 |
# Release Notes
|
| 2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
## Version 0.0.3 - October 20, 2025
|
| 4 |
|
| 5 |
**Summary:** Critical bug fix for record count display and pagination system to ensure all database records are properly loaded and displayed.
|
|
|
|
| 1 |
# Release Notes
|
| 2 |
|
| 3 |
+
## Version 0.0.4 - October 25, 2025
|
| 4 |
+
|
| 5 |
+
**Summary:** Added complete writing tasks support to the application.
|
| 6 |
+
|
| 7 |
+
### π New Features
|
| 8 |
+
- **Writing Tasks Support**: Full implementation of CELPIP-style writing tasks
|
| 9 |
+
- **Task Types**: Added support for email writing and survey response tasks
|
| 10 |
+
- **Category Switching**: Users can now browse both Speaking and Writing tasks
|
| 11 |
+
|
| 12 |
+
### π§ Technical Changes
|
| 13 |
+
- **Database Integration**: Writing tasks loaded from Supabase writing_tasks table
|
| 14 |
+
- **Task Type Mapping**: Fixed mapping to match database schema (email, survey_response)
|
| 15 |
+
- **Data Loading**: Updated to load both speaking and writing tasks from database
|
| 16 |
+
|
| 17 |
+
---
|
| 18 |
+
|
| 19 |
## Version 0.0.3 - October 20, 2025
|
| 20 |
|
| 21 |
**Summary:** Critical bug fix for record count display and pagination system to ensure all database records are properly loaded and displayed.
|
package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
{
|
| 2 |
"name": "english-brainstormer",
|
| 3 |
-
"version": "0.0.
|
| 4 |
"private": true,
|
| 5 |
"type": "module",
|
| 6 |
"scripts": {
|
|
|
|
| 1 |
{
|
| 2 |
"name": "english-brainstormer",
|
| 3 |
+
"version": "0.0.4",
|
| 4 |
"private": true,
|
| 5 |
"type": "module",
|
| 6 |
"scripts": {
|
src/pages/index.astro
CHANGED
|
@@ -17,8 +17,8 @@ const SPEAKING_TASK_MAPPING: Record<string, [number, string]> = {
|
|
| 17 |
};
|
| 18 |
|
| 19 |
const WRITING_TASK_MAPPING: Record<string, [number, string]> = {
|
| 20 |
-
|
| 21 |
-
|
| 22 |
};
|
| 23 |
|
| 24 |
// Load the data client-side after authentication
|
|
@@ -429,8 +429,8 @@ const initialPageInfo = totalItems === 0 ? 'Page 0 of 0' : `Page 1 of ${totalPag
|
|
| 429 |
{id: 'expressing_opinions', number: 7, label: 'Expressing Opinions', display: 'Task 7 - Expressing Opinions'}
|
| 430 |
],
|
| 431 |
Writing: [
|
| 432 |
-
{id: '
|
| 433 |
-
{id: '
|
| 434 |
]
|
| 435 |
},
|
| 436 |
categories: [
|
|
@@ -970,14 +970,48 @@ const initialPageInfo = totalItems === 0 ? 'Page 0 of 0' : `Page 1 of ${totalPag
|
|
| 970 |
|
| 971 |
console.log(`Total loaded ${allSpeakingData.length} speaking records`);
|
| 972 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 973 |
// Update the app data with loaded records
|
| 974 |
appData.records.Speaking = allSpeakingData;
|
| 975 |
-
|
|
|
|
| 976 |
// Update task options and apply state
|
| 977 |
updateTaskOptions();
|
| 978 |
applyState();
|
| 979 |
|
| 980 |
-
return { speaking: allSpeakingData, writing:
|
| 981 |
} catch (error) {
|
| 982 |
console.error('Error loading data from Supabase:', error);
|
| 983 |
return { speaking: [], writing: [] };
|
|
|
|
| 17 |
};
|
| 18 |
|
| 19 |
const WRITING_TASK_MAPPING: Record<string, [number, string]> = {
|
| 20 |
+
email: [1, 'Writing An Email'],
|
| 21 |
+
survey_response: [2, 'Responding To Survey Questions'],
|
| 22 |
};
|
| 23 |
|
| 24 |
// Load the data client-side after authentication
|
|
|
|
| 429 |
{id: 'expressing_opinions', number: 7, label: 'Expressing Opinions', display: 'Task 7 - Expressing Opinions'}
|
| 430 |
],
|
| 431 |
Writing: [
|
| 432 |
+
{id: 'email', number: 1, label: 'Writing An Email', display: 'Task 1 - Writing An Email'},
|
| 433 |
+
{id: 'survey_response', number: 2, label: 'Responding To Survey Questions', display: 'Task 2 - Responding To Survey Questions'}
|
| 434 |
]
|
| 435 |
},
|
| 436 |
categories: [
|
|
|
|
| 970 |
|
| 971 |
console.log(`Total loaded ${allSpeakingData.length} speaking records`);
|
| 972 |
|
| 973 |
+
// Load writing data using pagination to fetch all records
|
| 974 |
+
let allWritingData = [];
|
| 975 |
+
hasMore = true;
|
| 976 |
+
offset = 0;
|
| 977 |
+
|
| 978 |
+
while (hasMore) {
|
| 979 |
+
const { data: pageData, error: pageError } = await supabase
|
| 980 |
+
.from('writing_tasks')
|
| 981 |
+
.select('*')
|
| 982 |
+
.order('id', { ascending: true })
|
| 983 |
+
.range(offset, offset + pageSize - 1);
|
| 984 |
+
|
| 985 |
+
if (pageError) {
|
| 986 |
+
console.error('Error loading writing data page:', pageError);
|
| 987 |
+
break;
|
| 988 |
+
}
|
| 989 |
+
|
| 990 |
+
if (pageData && pageData.length > 0) {
|
| 991 |
+
allWritingData = allWritingData.concat(pageData);
|
| 992 |
+
console.log(`Loaded writing page ${Math.floor(offset / pageSize) + 1}: ${pageData.length} records`);
|
| 993 |
+
|
| 994 |
+
if (pageData.length < pageSize) {
|
| 995 |
+
hasMore = false;
|
| 996 |
+
} else {
|
| 997 |
+
offset += pageSize;
|
| 998 |
+
}
|
| 999 |
+
} else {
|
| 1000 |
+
hasMore = false;
|
| 1001 |
+
}
|
| 1002 |
+
}
|
| 1003 |
+
|
| 1004 |
+
console.log(`Total loaded ${allWritingData.length} writing records`);
|
| 1005 |
+
|
| 1006 |
// Update the app data with loaded records
|
| 1007 |
appData.records.Speaking = allSpeakingData;
|
| 1008 |
+
appData.records.Writing = allWritingData;
|
| 1009 |
+
|
| 1010 |
// Update task options and apply state
|
| 1011 |
updateTaskOptions();
|
| 1012 |
applyState();
|
| 1013 |
|
| 1014 |
+
return { speaking: allSpeakingData, writing: allWritingData };
|
| 1015 |
} catch (error) {
|
| 1016 |
console.error('Error loading data from Supabase:', error);
|
| 1017 |
return { speaking: [], writing: [] };
|
src/utils/loadData.ts
CHANGED
|
@@ -66,11 +66,6 @@ export async function loadSpeakingData(taskType?: string): Promise<SpeakingRecor
|
|
| 66 |
}
|
| 67 |
|
| 68 |
export async function loadWritingData(taskType?: string): Promise<SpeakingRecord[]> {
|
| 69 |
-
// TODO: Add writing tasks data in the future
|
| 70 |
-
// 1. Create writing_tasks table using scripts/create-tables.sql
|
| 71 |
-
// 2. Create writing.jsonl file with writing task data
|
| 72 |
-
// 3. Run migration: node scripts/migrate-data.js --file=data/writing.jsonl --type=writing
|
| 73 |
-
// For now, returns empty array since writing tasks are not implemented yet
|
| 74 |
return loadFromDatabase('writing_tasks', taskType);
|
| 75 |
}
|
| 76 |
|
|
|
|
| 66 |
}
|
| 67 |
|
| 68 |
export async function loadWritingData(taskType?: string): Promise<SpeakingRecord[]> {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 69 |
return loadFromDatabase('writing_tasks', taskType);
|
| 70 |
}
|
| 71 |
|