Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 127aab0

Browse files
[csharp] [courses_steps_csv] Provide semantics to video step type
1 parent d881a3a commit 127aab0

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

‎examples/csharp/csharp-courses_steps_csv-02_semantics/src/CoursesStepsCsv/CourseStepsGetController.cs‎

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ namespace CodelyTv.CoursesStepsCsv
88
{
99
public sealed class CourseStepsGetController
1010
{
11+
private const double VIDEO_DURATION_PAUSES_MULTIPLIER = 1.1;
12+
1113
private readonly Platform platform;
1214

1315
public CourseStepsGetController(Platform platform)
@@ -28,17 +30,18 @@ public string Get(string courseId)
2830
var row = lines[i].Split(',');
2931

3032
var type = row[1];
31-
var duration = 0.0;
33+
var stepDuration = 0.0;
3234
var points = 0.0;
3335

3436
if (type == "video")
3537
{
36-
duration = int.Parse(row[3]) * 1.1;
38+
var videoDuration = int.Parse(row[3]);
39+
stepDuration = videoDuration * VIDEO_DURATION_PAUSES_MULTIPLIER;
3740
}
3841

3942
if (type == "quiz")
4043
{
41-
duration = int.Parse(row[2]) * 0.5; // 0.5 = time in minutes per question
44+
stepDuration = int.Parse(row[2]) * 0.5; // 0.5 = time in minutes per question
4245
}
4346

4447
if (type != "video" && type != "quiz")
@@ -48,7 +51,7 @@ public string Get(string courseId)
4851

4952
if (type == "video")
5053
{
51-
points = int.Parse(row[3])*1.1 * 100;
54+
points = stepDuration * 100;
5255
}
5356

5457
if (type == "quiz")
@@ -60,7 +63,7 @@ public string Get(string courseId)
6063
{
6164
Id = row[0],
6265
Type = row[1],
63-
Duration = duration,
66+
Duration = stepDuration,
6467
Points = points
6568
};
6669

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /