Skip to content
This repository has been archived by the owner on Jun 16, 2021. It is now read-only.

searchCourseMixedResult.json 数据问题 #128

Closed
zion302 opened this issue Jun 9, 2021 · 6 comments
Closed

searchCourseMixedResult.json 数据问题 #128

zion302 opened this issue Jun 9, 2021 · 6 comments
Labels
Invalid This doesn't seem right

Comments

@zion302
Copy link

zion302 commented Jun 9, 2021

目前searchCourse1里1000个case就剩下40几个没有match的,都在 searchCourseMixed里面。举例其中已发现问题的一个:
searchCourseMixed里下标为24的为:
image
location 含‘二教’ , dayofweek=Wednesday,courseType=Public。

对应searchCourseMixedResult位置的search结果为:
image
有两个sectionclass, 其中第二个没问题,都符合搜索的条件,但是第一个,dayofweek,地点都不符合。不明白为什么会是要求的搜索结果?还是我有啥地方没get到?

@NewbieOrange
Copy link
Owner

文档中说了搜索条件是能同时匹配任一个class即可,而每个entry是整个课啊,肯定包括所有class。

@NewbieOrange NewbieOrange added the Invalid This doesn't seem right label Jun 9, 2021
@zion302
Copy link
Author

zion302 commented Jun 10, 2021

文档中说了搜索条件是能同时匹配任一个class即可,而每个entry是整个课啊,肯定包括所有class。

每个entry对应一个section, 这个section_id下面可以有多个class,不一定都符合搜索的条件,比如上面的这个case。实际上,代码是可以把不符合的class filter掉,只返回/显示给选课者真正符合其要求的class。而不是section下面只要有一个class符合,就返回所有的class。具体的就是CourseSearchEntry class里section_classes成员,是个List,你可以选择只放入符合条件的class。我觉得这样更make sense, 即使对于选课者而言。
Anyway, dto里entry 类的__eq__是这样设定的,不是两者完全相等,而是a的items都在被比较者b里面就认为是 equal.这样的话,我说的filter掉不符合条件class后的entry也会符合result test的要求。
`@dataclass()
class CourseSearchEntry:
course: Course
section: CourseSection
section_classes: List[CourseSectionClass]
conflict_course_names: List[str]

def __eq__(self, other):
    cnt = 0
    for c in self.section_classes:
        for x in other.section_classes:
            if c == x:
                cnt = cnt + 1
    return self.course == other.course and self.section == other.section \
           and cnt == len(self.section_classes) `

@NewbieOrange
Copy link
Owner

这怎么make sense了?你又不能只选一个class。

@zion302
Copy link
Author

zion302 commented Jun 10, 2021

当然可以选多个classes, 但是是从符合搜索条件的的classes里选,否则你要那么多的search条件做什么。。。老师的名字,上课地点。。这些都是对应具体某个class, 你把不符合条件的class 返回不是会confuse吗,真正的选课系统是个GUI, 会显示返回的classes, 包括不符合搜索条件的classes, 这样不会confuse用户吗?用户还需要手动识别他真正要找的class。而且会占用页面空间。
刚发现 dto里判断 entry equal的代码又改了。现在要求a和b里的完全对等。真晕。。。
def __eq__(self, other): # cnt = 0 # for c in self.section_classes: # for x in other.section_classes: # if c == x: # cnt = cnt + 1 def contains(A, B): for b in B: if b not in A: return False return True return self.course == other.course \ and self.section == other.section \ and contains(self.section_classes, other.section_classes) and contains(other.section_classes, self.section_classes) \ and sorted(self.conflict_course_names) == sorted(other.conflict_course_names)

@NewbieOrange
Copy link
Owner

你的理解有问题,你上一门课肯定不能只选理论课或者实验课,选课的最小单位是section。

@zion302 zion302 closed this as completed Jun 10, 2021
@zion302
Copy link
Author

zion302 commented Jun 10, 2021

确实,一个section下多个class只是理论课及其绑定的实验课。而不是多个独立可选的其他课。其他课会列在另外的section_id里面。thanks for your patience -:)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Invalid This doesn't seem right
Projects
None yet
Development

No branches or pull requests

2 participants