gpt4 book ai didi

database - Firestore : Academic Timetable Structure

转载 作者:搜寻专家 更新时间:2023-10-30 23:27:31 25 4
gpt4 key购买 nike

我正在尝试找出一种有效的结构来在 Firestore 中存储学术时间表。

我需要解决的问题:

  • 每门类(class)都有自己的开始和结束时间
  • 每门类(class)都有自己的周数
  • 每门类(class)有许多不同的时间表
  • 需要能够分析每节课的出勤情况

这是我现在的结构:

courses
- course_id: string
- duration: number (weeks, eg: 24)
- end_time: number (timestamp of the last course day)
- start_time: number (timestamp of the first course day)
- name: string

modules
- module_id: string
- lectures: array
- lecture_id
- name: string
- code: string
- no_students: number

classes
- class_id: string;
- start_time: string (eg: 10:00)
- end_time: string (eg: 11:00)
- weekday: string (eg: Monday)
- module: map (a copy of module object to reduce reads)
- start_week: number
- end_week: number

timetables
- timetable_id: string
- classes: array
- class_id
- duration: number (duration in weeks, eg: 11)
- semester: number
- week: string (current week, eg: 4)

users
...
- timetable_id: string

一个单独的类(class)集合将允许更容易查询以与出勤集合进行比较。

要读取时间表,我获取用户文档,然后获取时间表文档,然后使用 firestore.getAll() 获取类。这会导致大量文档读取。

要更新本周,我需要更新每个时间表文档。

解决这个问题的更好方法是什么?

感谢您的宝贵时间和帮助。

最佳答案

最好在 Firestore 的不同文档中重复重要数据。

假设戴安娜想通过电话阅读她的时间表,她的时间表有 4 门类(class)、3 个模块、10 节课。将所有这些详细信息放在一个文档中,因此当她想在应用程序屏幕上查看她的时间表时,该应用程序会读取一个文档来完成她的时间表。每个学生都会有自己的时间表文件

关于database - Firestore : Academic Timetable Structure,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54632534/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com