From ffc469a40794e050492ac892a105372aba981718 Mon Sep 17 00:00:00 2001 From: Niraj Nandish Date: Wed, 23 Jul 2025 06:40:28 +0530 Subject: [PATCH 1/3] Revert "chore: update learn_landing.dart to use v2 data (#1542)" This reverts commit 2f273ced8052f3dbd040ffc53357e9b001fbe79f. --- .../integration_test/learn/learn_landing.dart | 26 +++++++------------ .../lib/service/learn/learn_service.dart | 2 ++ 2 files changed, 11 insertions(+), 17 deletions(-) diff --git a/mobile-app/integration_test/learn/learn_landing.dart b/mobile-app/integration_test/learn/learn_landing.dart index 76e59a54c..f09a2c9d3 100644 --- a/mobile-app/integration_test/learn/learn_landing.dart +++ b/mobile-app/integration_test/learn/learn_landing.dart @@ -20,24 +20,16 @@ void main() { await tester.pumpAndSettle(); await binding.takeScreenshot('learn/learn-landing'); - String baseUrlV2 = LearnService.baseUrlV2; - final Response res = await dio.get('$baseUrlV2/available-superblocks.json'); - Map superBlockStages = res.data['superblocks']; + String baseUrl = LearnService.baseUrl; + final Response res = await dio.get('$baseUrl/available-superblocks.json'); + List superBlocks = res.data['superblocks']; int publicSuperBlocks = 0; - int totalSuperBlocks = 0; - - // Iterate through each stage and count the superblocks - superBlockStages.forEach((stage, superBlocksList) { - for (final superBlock in superBlocksList) { - totalSuperBlocks++; - if (superBlock['public']) { - publicSuperBlocks++; - } - } - }); - print('Total SuperBlocks: $totalSuperBlocks'); - print('Total Public SuperBlocks: $publicSuperBlocks'); + for (int i = 0; i < superBlocks.length; i++) { + if (superBlocks[i]['public']) { + publicSuperBlocks++; + } + } await tester.pumpAndSettle(); // Check if all superblocks are displayed @@ -45,7 +37,7 @@ void main() { final publicSuperBlockButtons = find.byWidgetPredicate( (widget) => widget is SuperBlockButton && widget.button.public == true, ); - expect(superBlockButtons, findsNWidgets(totalSuperBlocks)); + expect(superBlockButtons, findsNWidgets(superBlocks.length)); expect(publicSuperBlockButtons, findsNWidgets(publicSuperBlocks)); // Check for login button diff --git a/mobile-app/lib/service/learn/learn_service.dart b/mobile-app/lib/service/learn/learn_service.dart index a369685b8..6e4e23917 100644 --- a/mobile-app/lib/service/learn/learn_service.dart +++ b/mobile-app/lib/service/learn/learn_service.dart @@ -23,6 +23,8 @@ class LearnService { final Dio _dio = DioService.dio; + // TODO: change this to v2 and remove baseUrlV2 once the migration is complete + static final baseUrl = '${AuthenticationService.baseURL}/curriculum-data/v1'; static final baseUrlV2 = '${AuthenticationService.baseURL}/curriculum-data/v2'; From b049f91196f0e81b4031479035964cf6d8f42c2c Mon Sep 17 00:00:00 2001 From: Niraj Nandish Date: Wed, 23 Jul 2025 06:57:33 +0530 Subject: [PATCH 2/3] chore: use old landing SB order --- .../learn/landing/landing_viewmodel.dart | 58 ++++++++++++------- 1 file changed, 37 insertions(+), 21 deletions(-) diff --git a/mobile-app/lib/ui/views/learn/landing/landing_viewmodel.dart b/mobile-app/lib/ui/views/learn/landing/landing_viewmodel.dart index f21774892..80463e70e 100644 --- a/mobile-app/lib/ui/views/learn/landing/landing_viewmodel.dart +++ b/mobile-app/lib/ui/views/learn/landing/landing_viewmodel.dart @@ -74,7 +74,7 @@ class LearnLandingViewModel extends BaseViewModel { lastVisitedChallenge[0], ); - String baseUrl = LearnService.baseUrlV2; + String baseUrl = LearnService.baseUrl; final Response res = await _dio.get('$baseUrl/${lastVisitedChallenge[1]}.json'); @@ -158,37 +158,53 @@ class LearnLandingViewModel extends BaseViewModel { } Future> requestSuperBlocks() async { - String baseUrl = LearnService.baseUrlV2; + String baseUrl = LearnService.baseUrl; final Response res = await _dio.get('$baseUrl/available-superblocks.json'); List layout = []; if (res.statusCode == 200) { - Map superBlockStages = res.data['superblocks']; - await dotenv.load(fileName: '.env'); bool showAllSB = dotenv.get('SHOWALLSB', fallback: 'false').toLowerCase() == 'true'; - for (var superBlockStage in superBlockStages.keys) { - layout.add(Padding( - padding: const EdgeInsets.all(8.0), - child: handleStageTitle(superBlockStage), - )); - - for (var superBlock in superBlockStages[superBlockStage]) { - layout.add( - SuperBlockButton( - button: SuperBlockButtonData( - path: superBlock['dashedName'], - name: superBlock['title'], - public: !showAllSB ? superBlock['public'] : true, - ), - model: this, - ), - ); + // Map superBlockStages = res.data['superblocks']; + // for (var superBlockStage in superBlockStages.keys) { + // layout.add(Padding( + // padding: const EdgeInsets.all(8.0), + // child: handleStageTitle(superBlockStage), + // )); + + // for (var superBlock in superBlockStages[superBlockStage]) { + // layout.add( + // SuperBlockButton( + // button: SuperBlockButtonData( + // path: superBlock['dashedName'], + // name: superBlock['title'], + // public: !showAllSB ? superBlock['public'] : true, + // ), + // model: this, + // ), + // ); + // } + // } + + List superBlocks = res.data['superblocks']; + for (int i = 0; i < superBlocks.length; i++) { + if (superBlocks[i]['dashedName'].toString().contains('full-stack')) { + continue; } + layout.add( + SuperBlockButton( + button: SuperBlockButtonData( + path: superBlocks[i]['dashedName'], + name: superBlocks[i]['title'], + public: !showAllSB ? superBlocks[i]['public'] : true, + ), + model: this, + ), + ); } return layout; From 1ce7c11c9e74e5cc99aafdd8f9c6ed0540ee9ce3 Mon Sep 17 00:00:00 2001 From: Niraj Nandish Date: Wed, 23 Jul 2025 07:11:27 +0530 Subject: [PATCH 3/3] fix: learn landing integration test --- mobile-app/integration_test/learn/learn_landing.dart | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mobile-app/integration_test/learn/learn_landing.dart b/mobile-app/integration_test/learn/learn_landing.dart index f09a2c9d3..5cc802017 100644 --- a/mobile-app/integration_test/learn/learn_landing.dart +++ b/mobile-app/integration_test/learn/learn_landing.dart @@ -37,7 +37,10 @@ void main() { final publicSuperBlockButtons = find.byWidgetPredicate( (widget) => widget is SuperBlockButton && widget.button.public == true, ); - expect(superBlockButtons, findsNWidgets(superBlocks.length)); + expect( + superBlockButtons, + findsNWidgets(superBlocks.length - 1), // Exclude 'full-stack' superblock + ); expect(publicSuperBlockButtons, findsNWidgets(publicSuperBlocks)); // Check for login button