• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

EsupPortail / Esup-Pod / 12907943433

22 Jan 2025 12:13PM UTC coverage: 70.681%. First build
12907943433

Pull #1233

github

web-flow
Merge a8427e019 into 2d84b4213
Pull Request #1233: [DONE] WebTV features

59 of 93 new or added lines in 12 files covered. (63.44%)

12054 of 17054 relevant lines covered (70.68%)

0.71 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

75.0
/pod/speaker/utils.py
1
"""Esup-Pod speaker utilities."""
2

3
from typing import Optional, Dict, List
1✔
4
from pod.speaker.models import Speaker, JobVideo
1✔
5
from pod.video.models import Video
1✔
6

7

8
def get_all_speakers() -> Optional[Speaker]:
1✔
9
    """
10
    Retrieve the speakers list.
11

12
    Returns:
13
        Optional[Speakers]: The speakers list, or None if no speaker is found.
14
    """
15
    return Speaker.objects.prefetch_related("job_set").all()
1✔
16

17

18
def get_video_speakers(video: Video) -> Optional[JobVideo]:
1✔
19
    """
20
    Retrieve the speakers associated with a given video.
21

22
    Args:
23
        video (Video): The video for which to retrieve the speakers.
24

25
    Returns:
26
        Optional[JobVideo]: The jobs associated with the video, or None if no job is found.
27
    """
28
    return JobVideo.objects.filter(video=video)
1✔
29

30

31
def get_video_speakers_grouped(video) -> Dict[Speaker, List[str]]:
1✔
32
    """
33
    Group the jobs by speaker for a given video.
34

35
    Args:
36
        video (Video): The video for which to group the speakers.
37

38
     Returns:
39
        Dict[Speaker, List[str]]: A dictionary where the keys are the speakers (Speaker)
40
        and the values are lists of job titles (str) associated with each speaker.
41
    """
42
    speakers = video.jobvideo_set.select_related('job__speaker').all()
1✔
43
    grouped_speakers = {}
1✔
44
    for jobvideo in speakers:
1✔
NEW
45
        speaker = jobvideo.job.speaker
×
NEW
46
        if speaker not in grouped_speakers:
×
NEW
47
            grouped_speakers[speaker] = []
×
NEW
48
        grouped_speakers[speaker].append(jobvideo.job.title)
×
49
    return grouped_speakers
1✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc