Skip to content

Commit

Permalink
Merge dev-led to main (#35)
Browse files Browse the repository at this point in the history
* Better navigation, Timer functioning, on progress latex

* Fixed latex, better ui

* Fixed quiz upload input bug, few changes in its UI, and changed cubit deets

* Better upload details. Quizzes now have UserRef and SolutionsRef

* Working solutions page, with working scores

* Working solutions page, with working scores p2
  • Loading branch information
draqunov10 authored Mar 12, 2024
1 parent 86b3463 commit 0e09d49
Show file tree
Hide file tree
Showing 57 changed files with 1,573 additions and 1,040 deletions.
79 changes: 79 additions & 0 deletions d
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
86b3463 (HEAD -> dev-led, origin/main, origin/dev-led, origin/HEAD, main) style: improve user profile UI/UX
3b59a19 feat: reset password via email
0eb834e dev: very rough release candidate v0.0.1
a8ca87d chore: sync git
ea5178b Quiz mode and upload feature (#28)
de56798 dev: basic profile screen
59b56f3 dev: auth sign-out option
d3a2d13 dev: backend code for email & password authentication
cc03ebc dev: other experimental rich text editor using Markdown (w/ latex support)
930ece0 style: improve layout and visual elements in email verification screen
d5c7456 dev: backend code for email verification
ed8ace7 dev: add working BE code for creating a user
3cb413d dev: add UserEntity
3b2e6d8 (origin/dev) chore: daily git sync
40533dd dev: explore the viability of flutter_quill text editor (experimental)
9558e2f deps: add flutter_quill and set proper configurations
cd06c58 style: add signup screen and validators
edb7f15 dev: git daily sync
e97d12f style: add reset password screen, password reset email confirmation, and validators
7dfe0ec style: add login screen
cbb8640 refactor: convert Entity and Params interfaces to base classes
cd01dd1 dev: add custom Failure classes
dbe2873 refactor: improve custom Exception classes
f68d955 dev: add utility exception classes (auth and db)
c05e662 dev: setup the folder structure for the core features: auth, app_settings, and system
76928c8 style: setup general screens
664bd8f dev: add no_params class and use case interface
545489d dev: add failure and params interfaces
6c219de dev: add entity and exception interfaces
686e5c8 style: add icon launcher for android and web
272adc3 style: implement a native splash screen (supports light and dark mode)
bcedf26 dev: clean assets folder and add sg-scholar's guide logos
3b35948 dev: refactor app_router and upgrade go_router dependency
5dd9766 dev: implement a nested and stateful router (using go_router and NavigationBar)
d59ab29 style: add different app themes
779c18b dev: add a ServiceLocator (using get_it package)
3212041 dev: add UpCampuses enum
7d3bad7 dev: add StorageTypes enum
67c4a8b dev: add Genders and Sex enums
3070e29 dev: add OnlineTimeSource enum
eb79b9c dev: add AccountTypes enum
c7e8640 dev: add AppColors utility class
7a0aed5 fix: add flutter cli in github ci
b46554b fix: enable firebase experimental web framework support (2)
45a3b2a fix: enable firebase experimental web framework support
fdbe1b0 fix: remove npm run build error
1815a27 fix: remove npm ci error (2) via generation of package-lock.json
4dc3927 fix: remove npm ci error
af535cf feat: enable firebase web app hosting
fc57e15 fix: add multidex support
f0c1528 deps: add go_router, bloc, and tes oriented dev dependencies
774b890 deps: add relevant firebase features
a726300 deps: initialize firebase core
6fec13f chore: remove remnant node_modules dir
a4011e5 chore: add foundational assets
a2c1c49 chore: initialize flutter project
caf3db3 chore: Add LICENSE
2d9e7c0 Update README.md
c910fd2 Update README.md
96d01e6 chore: wipe repo (change from nuxt to flutter)
cd12869 Update README.md
5f9cc43 Initialize firebase hosting
6221d0e Add firebase
b83e093 Add basic email verification logic
285bc5d Add basic forgot password logic
dc03fcb Add basic login auth logic (using Appwrite)
f761b88 Add email verification page view
83ca2c1 Add sign-up page view
293f5cf Add forgot password page view
bd76adb Add login page view
0ea4124 Update README.md
3bf6648 feat: Initialize project - Led (#20)
42d4622 Initialize WebStorm IDE dev environment
cdd7465 Create README.md
1bd46ad Create SECURITY.md (#2)
44a9f4b Update FUNDING.yml
03ca1d5 Create FUNDING.yml
60caecf Update issue templates
072f3a6 Initial commit
5 changes: 5 additions & 0 deletions lib/core/models/firestore_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ import 'package:scholars_guide/core/models/question_model.dart';

class FireStore {
//* Collection names in the Firestore
static const solutionsCollection = 'solutions';
static const commentsCollection = 'comments';
static const additionalQuestionDataRef = 'additionalQuestionsData';
static const subjects = {
SUBJ.MATH: 'mathematicsQuestions',
SUBJ.SCIENCE: 'scienceQuestions',
Expand All @@ -15,6 +18,8 @@ class FireStore {
//* Field names of each document in the Firestore
// Question related fields
static const String question = 'question';
static const String solutionRef = 'solutionsRef';
static const String solutionData = 'solutionData';
static const String options = 'choices';
static const String correctIndex = 'correctChoiceKey';
// static const String questionReference = 'additionalQuestionDataRef';
Expand Down
43 changes: 33 additions & 10 deletions lib/core/models/question_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,44 +2,64 @@

import 'dart:math';

import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:scholars_guide/core/models/firestore_model.dart';

enum SUBJ { MATH, SCIENCE, READING, LANGUAGE, ALL }

class Question {
final String question;
final List<String> options;
final int correctIndex;
final SUBJ subject;

const Question({
Question({
required this.question,
required this.options,
required this.correctIndex,
required this.subject,
this.id = '',
this.solution = '',
this.solutionRef,
this.createdBy,
});

final String question;
final List<String> options;
final int correctIndex;
final SUBJ subject;
String id;
String solution;
DocumentReference? solutionRef;

DocumentReference? createdBy;
final FieldValue createdAt = FieldValue.serverTimestamp();

static var updatedAt = FieldValue.serverTimestamp();
static const String updatedBy = ''; // ! This is a placeholder

static bool isVerified = false;
static const String verifiedAt = '';
static const String verifiedBy = '';

void printQuestion() {
print('Question: $question');
print('Options: $options');
print('Correct: $correctIndex');
}

// Returns a Question Class using data fetched from the Firestore
factory Question.fromMap(Map<String, dynamic> data, SUBJ subject) {
factory Question.fromMap(String id, Map<String, dynamic> data, SUBJ subject) {
List<String> temp = [];
for (var val in data[FireStore.options].values) {
temp.add(val);
}

String temp2 = temp[int.parse(data[FireStore.correctIndex])];
String temp2 = temp[int.parse(data[FireStore.correctIndex])];
temp.shuffle(Random());

return Question(
id: id,
subject: subject,
question: data[FireStore.question],
solutionRef: data[FireStore.solutionRef],
options: temp,
correctIndex: temp.indexWhere((element) => element == temp2));
correctIndex: temp.indexWhere((element) => element == temp2),
createdBy: data[FireStore.createdBy]);
}

// Converts the Question Class to a json like file to be stored in the Firestore
Expand All @@ -53,6 +73,9 @@ class Question {
'3': options[3],
},
FireStore.correctIndex: correctIndex.toString(),
FireStore.solutionRef: solutionRef,
FireStore.createdBy: createdBy,
FireStore.createdAt: createdAt,
};
}

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,37 @@
// import 'package:scholars_guide/service_locator/service_locator.dart';

import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:firebase_core/firebase_core.dart';
import 'package:scholars_guide/core/models/firestore_model.dart';
import 'package:scholars_guide/core/models/question_model.dart';
import 'package:scholars_guide/features/quiz_mode/domain/repositories_contract/quiz_mode_repository_contract.dart';
import 'package:scholars_guide/firebase_options.dart';

class QuizModeRepositoryImpl implements QuizModeRepositoryContract{
import '../../../../service_locator/service_locator.dart';

class QuizModeRepositoryImpl implements QuizModeRepositoryContract {
const QuizModeRepositoryImpl();

@override
Future<List<Question>> collectQuestions({required SUBJ subj}) async {
final dbService = services<FirebaseFirestore>();
List<Question> questions = [];

await Firebase.initializeApp(options: DefaultFirebaseOptions.currentPlatform)
.whenComplete(() => FirebaseFirestore.instance
.collection(FireStore.SUBJ2subject(subj))
.get()
.then((snapshot) => snapshot.docs
.map((e) => questions.add(Question.fromMap(e.data(), subj))).toList()));
// * Fetching the questions from the Firestore
await dbService
.collection(FireStore.SUBJ2subject(subj))
.get()
.then((snapshot) {
print("GETTING QUESTIONS");
snapshot.docs
.map((e) => questions.add(Question.fromMap(e.id, e.data(), subj)))
.toList();
});

// TODO: Update imports and change actual code below once get_it is done
// await fetchQuestions(subject).then((snapshot) => snapshot.docs.map((e) => questions.add(Question.fromMap(e.data(), subj))));
print("DONE COLLECTING QUESTIONS ========================================"); // ! Debugging
return questions;
// * Fetching the solutions from the Firestore
for (Question q in questions) {
await q.solutionRef?.get().then((value) {
q.solution = value[FireStore.solutionData];
});
}
return questions;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ class ChooseQuestions {
List<Question> totalQuestions =
await const QuizModeRepositoryImpl().collectQuestions(subj: subj);
totalQuestions.shuffle(Random());
// TODO: randomize the choices as well for each question

return totalQuestions.sublist(
0,
Expand Down
Loading

0 comments on commit 0e09d49

Please sign in to comment.