File tree Expand file tree Collapse file tree 5 files changed +245
-129
lines changed Expand file tree Collapse file tree 5 files changed +245
-129
lines changed Original file line number Diff line number Diff line change @@ -14,9 +14,14 @@ class PredictedCourse {
14
14
final double distribution;
15
15
16
16
factory PredictedCourse .fromJson (Map <String , dynamic > json) {
17
+ double gradePredictionValue = - 1 ;
18
+ if (json.containsKey ('gradePrediction' )){
19
+ gradePredictionValue = double .parse (json['gradePrediction' ].toString ());
20
+ }
21
+
17
22
return PredictedCourse (
18
23
courseID: json['id' ],
19
- gradePrediction: double . parse (json[ 'gradePrediction' ]. toString ()) ,
24
+ gradePrediction: gradePredictionValue ,
20
25
distribution: double .parse (json['distribution' ].toString ()));
21
26
}
22
27
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ import 'package:flutter/material.dart';
4
4
import 'package:grade_plus_plus/DataFetcher.dart' ;
5
5
import 'package:grade_plus_plus/entities/course/Course.dart' ;
6
6
import 'package:grade_plus_plus/entities/user/Teacher.dart' ;
7
+ import 'package:grade_plus_plus/pages/authentication/forms/PersonalForm.dart' ;
7
8
8
9
import '../LocalKeyValuePersistence.dart' ;
9
10
import '../entities/course/PredictedCourse.dart' ;
@@ -41,8 +42,9 @@ class _HomeScreenState extends State<HomeScreen> {
41
42
42
43
courses = DataFetcher .fetchCourses ();
43
44
teachers = DataFetcher .fetchTeachers ();
44
- predictedCourses = DataFetcher .fetchPredictedCourses ();
45
45
userData = DataFetcher .fetchUserData ();
46
+ predictedCourses = DataFetcher .fetchPredictedCourses ();
47
+
46
48
47
49
_loadLocalData (); // See the to-do below
48
50
}
@@ -73,6 +75,9 @@ class _HomeScreenState extends State<HomeScreen> {
73
75
builder: (BuildContext context, AsyncSnapshot <Merged > snapshot) {
74
76
List <Widget > children;
75
77
if (snapshot.hasData) {
78
+ if (snapshot.data.userData.name == null ){
79
+ return PersonalForm ();
80
+ }
76
81
pages = < AbstractPage > [
77
82
GradePredict (
78
83
predictedCourses: snapshot.data.predictedCourses,
You can’t perform that action at this time.
0 commit comments