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

Apply Split Phase refactoring #26

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
rgomezcasas wants to merge 15 commits into main
base: main
Choose a base branch
Loading
from split-phase
Draft
Changes from 1 commit
Commits
Show all changes
15 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Rename
  • Loading branch information
rgomezcasas committed Apr 14, 2021
commit d2f05b5011cf7f53ca93c4a832c18b045a3cebef
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

final class CourseStepsGetController
{
const VIDEO_DURATION_PAUSES_MULTIPLIER = 1.1;
private Platform $platform;

public function __construct(Platform $platform)
Expand All @@ -31,23 +32,24 @@ public function get(string $courseId): string
}

$type = $row[1];
$duration = 0;
$stepDuration = 0;
$points = 0;

$videoDuration = $row[3];
if ($type === 'video') {
$duration = $row[3] * 1.1; // 1.1 = due to video pauses
$stepDuration = $videoDuration * self::VIDEO_DURATION_PAUSES_MULTIPLIER;
}

if ($type === 'quiz') {
$duration = $row[2] * 0.5; // 0.5 = time in minutes per question
$stepDuration = $row[2] * 0.5; // 0.5 = time in minutes per question
}

if ($type !== 'video' && $type !== 'quiz') {
continue;
}

if ($type === 'video') {
$points = $row[3] * 1.1 * 100;
$points = $stepDuration * 100;
}

if ($type === 'quiz') {
Expand All @@ -58,7 +60,7 @@ public function get(string $courseId): string
[
'id' => $row[0],
'type' => $row[1],
'duration' => $duration,
'duration' => $stepDuration,
'points' => $points
],
JSON_THROW_ON_ERROR
Expand Down

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