Skip to content
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

Refactoring subscribed session list for user #5576

Merged
merged 7 commits into from
Jun 20, 2024

Conversation

AngelFQC
Copy link
Member

@AngelFQC AngelFQC commented Jun 6, 2024

According to session visibility by the user and considering sessions with access with a duration time

Refs BT#21745 #5560

@AngelFQC AngelFQC marked this pull request as ready for review June 6, 2024 13:53
@AngelFQC AngelFQC force-pushed the BT21745 branch 2 times, most recently from f897bce to 4b8d270 Compare June 6, 2024 17:58
@chamilo chamilo deleted a comment from codeclimate bot Jun 14, 2024
@chamilo chamilo deleted a comment from codeclimate bot Jun 14, 2024
@chamilo chamilo deleted a comment from codeclimate bot Jun 14, 2024
@chamilo chamilo deleted a comment from codeclimate bot Jun 14, 2024
@chamilo chamilo deleted a comment from codeclimate bot Jun 14, 2024
@chamilo chamilo deleted a comment from codeclimate bot Jun 14, 2024
@chamilo chamilo deleted a comment from codeclimate bot Jun 14, 2024
@chamilo chamilo deleted a comment from codeclimate bot Jun 14, 2024
@chamilo chamilo deleted a comment from codeclimate bot Jun 14, 2024
@chamilo chamilo deleted a comment from codeclimate bot Jun 14, 2024
@chamilo chamilo deleted a comment from codeclimate bot Jun 14, 2024
@@ -113,6 +114,7 @@ class Session implements ResourceWithAccessUrlInterface, Stringable
public const VISIBLE = 2;
public const INVISIBLE = 3;
public const AVAILABLE = 4;
public const LIST_ONLY = 5;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line indented incorrectly; expected 8 spaces, found 4

@@ -357,6 +359,9 @@
#[ORM\JoinColumn(name: 'image_id', referencedColumnName: 'id', onDelete: 'SET NULL')]
protected ?Asset $image = null;

#[Groups(['user_subscriptions:sessions', 'session:read', 'session:item:read'])]
private int $accessVisibility = 0;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line indented incorrectly; expected 8 spaces, found 4

@@ -1292,10 +1297,36 @@
return $totalDuration > $currentTime;
}

public function getDaysLeftByUser(User $user): int
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line indented incorrectly; expected 8 spaces, found 4

@@ -1292,10 +1297,36 @@
return $totalDuration > $currentTime;
}

public function getDaysLeftByUser(User $user): int
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing function doc comment

{
$userSessionSubscription = $user->getSubscriptionToSession($this);

$duration = $this->duration;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line indented incorrectly; expected at least 12 spaces, found 8


$duration = $this->duration;

if ($userSessionSubscription) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line indented incorrectly; expected 12 spaces, found 8

$duration = $this->duration;

if ($userSessionSubscription) {
$duration += $userSessionSubscription->getDuration();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line indented incorrectly; expected at least 16 spaces, found 12

$courseAccess = $user->getFirstAccessToSession($this);

if (!$courseAccess) {
return $duration;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line indented incorrectly; expected at least 16 spaces, found 12

return $duration;
}

$endDateInSeconds = $courseAccess->getLoginCourseDate()->getTimestamp() + $duration * 24 * 60 * 60;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line indented incorrectly; expected at least 12 spaces, found 8

$endDateInSeconds = $courseAccess->getLoginCourseDate()->getTimestamp() + $duration * 24 * 60 * 60;
$currentTime = time();

return (int) round(($endDateInSeconds - $currentTime) / 60 / 60 / 24);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line indented incorrectly; expected at least 12 spaces, found 8

Copy link

codeclimate bot commented Jun 14, 2024

Code Climate has analyzed commit 9fd6aeb and detected 43 issues on this pull request.

Here's the issue category breakdown:

Category Count
Style 43

View more on Code Climate.

@NicoDucou NicoDucou merged commit 6a105fb into chamilo:master Jun 20, 2024
3 of 7 checks passed
@AngelFQC AngelFQC deleted the BT21745 branch June 20, 2024 15:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants