File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed
examples/csharp/csharp-courses_steps_csv-02_semantics/src/CoursesStepsCsv Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments