Conversation
Levi-Lesches
left a comment
There was a problem hiding this comment.
Looking good, just you need to use the database the way RamLife sets it up. Similar to using models, you don't just do User.name, you look up Models.instance.user.name, you're going to have to do the same type of thing with the database. Good news is you have plenty of examples.
Also, never import 1) a src folder, or 2) deep into a "layer" (anything deeper than lib). Either refer to the file by name if they're next to each other, or modify the lib/layer.dart to include that file
| day == null ? null : Day.fromJson(day) | ||
| ] | ||
| ]; | ||
| Schedule.defaults = Map.from(await CloudCalendar.schedules. |
There was a problem hiding this comment.
You can't use the actual class Cloud Calendar here, you need to use an instance (look up static vs instance methods if you're confused). Get the database from:
Services.instance.database.scheduleAnd call default schedules on that. Of course, you'll need to implement that too, so look for how the database downloads the schedules and try to copy that.
lib/src/models/data/schedule.dart
Outdated
| import 'package:ramaz/src/services/databases/calendar/implementation.dart'; | ||
| import 'package:ramaz/src/services/firestore.dart'; |
| /// This function rep | ||
| // Future<void> deleteSchedules(Map<DateTime,Day> days) async { | ||
| // for (MapEntry<DateTime, Day> entry in days.entries){ | ||
| // entry.value.schedule!=ScheduleViewModel.defatulSchedule[entry.value.name]; | ||
| // await updateDay(day: entry.value, date: entry.key); | ||
| // } | ||
| // } |
There was a problem hiding this comment.
Delete this I guess, and the import above
|
|
||
|
|
||
| /// A Map of weekdays to their default schedule | ||
| static late Map<String, Schedule> defaults; |
There was a problem hiding this comment.
You can do this in three ways:
static late, which means there is no value until it's setMap<String, Schedule>?, which means it's null until setdefaults = {};, which means it's empty until set.
While 3 is easier to work with, I think you should do 1 or 2, since it implies it's invalid to search up a default schedule before the data is loaded. You can follow my example and use late, which implies there should always be some data and not having data is an error, but I think you should use a nullable map since late is kinda hacky in Dart but null is much more "normal".
| ); | ||
|
|
||
| @override | ||
| Future<Map<String, String>> getDefaultSchedules() async => Map.from( |
There was a problem hiding this comment.
| Future<Map<String, String>> getDefaultSchedules() async => Map.from( | |
| Future<Map<String, String>> getDefaultSchedules() async => |
You don't need Map here, unless you need to cast to a Map<String, String> specifically (which you might).
|
|
||
| @override | ||
| Future<Map<String, String>> getDefaultSchedules() => Idb.instance | ||
| .get("schedules","Monday") as Future<Map<String, String>>; |
There was a problem hiding this comment.
| .get("schedules","Monday") as Future<Map<String, String>>; | |
| .get("schedules","Monday"); |
- No
as, see above - Why Monday?
| static const String scheduleStoreName = "schedules"; | ||
|
|
||
| /// The name for the default schedules object store. | ||
| static const String defaultScheduleStoreName = "defaults"; |
There was a problem hiding this comment.
Ah, okay here's something -- should this really be a separate data store? Think of it like a "table" in SQL or a "collection" in Firestore: can you really say this is a whole collection of similarly-formatted entries? I think this should be filed under "miscellaneous" data somehow -- maybe use the SharedPreferences service? Sure, it's a bit weird in that you're using one service from another but I think RamLife can handle it.
| ..createObjectStore(sportsStoreName, autoIncrement: true) | ||
| ..createObjectStore(scheduleStoreName, keyPath: "name"); | ||
| ..createObjectStore(scheduleStoreName, keyPath: "name") | ||
| ..createObjectStore(defaultScheduleStoreName, keyPath: "Monday"); |
There was a problem hiding this comment.
See above, I don't think this is the way to go about it.
Co-authored-by: todesj <70974284+todesj@users.noreply.github.com>
* Added schedule_search.dart * Added schedule search model * Update lib/src/models/view/schedule_search.dart Co-authored-by: Levi Lesches <levilesches@gmail.com> * Update lib/src/models/view/schedule_search.dart Co-authored-by: Levi Lesches <levilesches@gmail.com> * Fixes some formatting * Added docs and exported schedule_search.dart in lib/models.dart * Cleaned up schedule_search.dart * Cleaned up models.dart * Added Subject.id, PeriodData.name, PerioData.dayName * Update lib/src/data/schedule/subject.dart Co-authored-by: Levi Lesches <levilesches@gmail.com> * Add Period.dayName, and Period.name (Student-Lyf#81) * Converted firestore/lib/src/helpers to firestore-py/lib/utils * Ported firestore/lib/src/services to firestore-py/lib/services * Removed (and revoked) Firebase credentials * Cleanup * Cleaned up logging/Firebase issues * Added some __init__.py * Ported firebase/firestore/node/calendar.dart to firebase/firestore-py/bin/calendar.py * Ported firebase/firestore/node/admins.dart to firebase/firestore-py/bin/admins.py * Ported firebase/firestore/node/feedback.dart to firebase/firestore-py/bin/feedback.py * Added some data python files and sections python files * Continued translating more files (Note: some are incomplete!) lib/data/schedule lib/sections/reader edited lib/utils/dir to use constants from constants.yaml * Added bin/faculty, bin/secions, facultylogic and facultyreader python files Also added constants.py to get data from constants.yaml * Ported firebase/firestore/node/students.dart --> firebase/firestore-py/bin/students.py * Cleanup * Delete student.py * Fix students.py and uploading * Added some more python files. many variable should be converted to snake_case * Changed camel case variables to snake_case * small edits, opted for a different constants.py file too * Fixed some typos * Fixed bug where testers had no schedule (instead of a blank one) * --- * Finished scripts to upload data * Changed dayNames to a list rather than set * Make Fridays a Friday schedule by default * Modified feedback.py to actually output feedback * Added students reader * Cleanup * Fixed a bug in faculty/logic.py where a (Student-Lyf#101) teacher's periods weren't being added to theit schedule, instead the teacher's schedule was being set to contain only one period. Co-authored-by: todesj <josht2004@gmail.com> Co-authored-by: todesj <70974284+todesj@users.noreply.github.com> Co-authored-by: Brayden Kohler <brayk0hler@gmail.com> Co-authored-by: BraydenKO <58378705+BraydenKO@users.noreply.github.com>
* Enabled Emulator use * Fixed emulator error * Update lib/src/services/firebase_core.dart Added doc comment for `FirebaseCore.shouldUseEmulator` Co-authored-by: Levi Lesches <levilesches@gmail.com>
Makes the schedule icon appear in the dashboard when the side sheet is not persistently open
Adds Podfile.lock to the repo and updates XCode.
…-Lyf#123) * Moved Firebase initialization logic to main using flutterfire_cli * Removed manual Firebase initialization for Web * Moved Dart-only Firebase initialization to FirebaseCore.initializeFirebase * Updated Firebase dependencies to support flutterfire_cli * Removed old (manual) calls to FirebaseCore.init(), replaced with new flutterfire_cli initialization * Added try/catch for Firestore emulator Workaround for firebase/flutterfire#6216 * Cleanup
Co-authored-by: Levi Lesches <levilesches@gmail.com>
Co-authored-by: Levi Lesches <levilesches@gmail.com>
Co-authored-by: Levi Lesches <levilesches@gmail.com>
Co-authored-by: Levi Lesches <levilesches@gmail.com>
Co-authored-by: Levi Lesches <levilesches@gmail.com>
b22707a to
7ba275b
Compare
|
I force-pushed to clean the history, now there are no merge conflicts |
No description provided.