应用程序逻辑和由于范围蔓延而发生的变化
我启动了一个应用程序,最初是一个测试平台——用户管理和可以查看员工测试的经理。
最近,功能已扩展(尚未构建),允许用户代替员工完成测试 - 基本上添加一条记录,但不添加用户。
我为此使用了三个表:用户(包含用于登录/安全的用户信息)、个人资料(所有个人信息:地址、身高等)和调查(包含用户的调查答案)。
如何扩展我的应用程序以在对结构进行最小更改的情况下包含此功能?
我认为最好的方法是将记录插入到表配置文件和调查中,并且没有用户名/密码/电子邮件?必须有一个关联的 user_id b/c 表通过 user_ids 链接...
I started an app that was initially a testing platform--user management, and managers that can view their employees tests.
Recently, functionality has been extended (not built yet) to allow users to complete a test in place of an employee--basically adding a record, but no user.
I have three tables in use for this: users(contains user info for login/security), profiles (all personal info: address, height, etc.), and survey (contains survey answers for user).
How do I extend my application to encompass this functionality with minimal change to the structure?
I assume that the best way to do this would be to insert records to the tables profiles and survey, and have no username/password/email? There MUST be a user_id associated b/c the tables are linked through the user_ids...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在我看来,您应该仍然有一个用户 - 否则您如何知道谁完成了个人资料和调查?
如果是经理创建个人资料和调查,只需让他们使用自己的用户帐户登录并创建测试个人资料即可。也就是说,单个用户将能够拥有多个个人资料和调查 - 这对于您当前的数据库设置来说似乎微不足道。
然后,当经理登录时,向他们展示他们自己的所有测试资料和调查,以及所有员工的资料和调查。
Seems to me you should still have a user - otherwise how will you know who completed the profile and survey?
If it's a manager creating the profile and survey, simply have them sign in with their own user account and create a test profile. That is, a single user will be able to have more than one profile and survey - which seems trivial with your current DB setup.
Then when a manager signs in, show them all of their own test profiles and surveys, and all of their employees' profiles and surveys.