-
Notifications
You must be signed in to change notification settings - Fork 486
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
Conversation
f897bce
to
4b8d270
Compare
…5560 According to session visibility by the user and considering sessions with access with a duration time
…current or past - refs BT#21745
…ation - refs BT#21745
…ccess by duration - refs BT#21745
…ity set - refs BT#21745
@@ -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; |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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
…list visibility - refs BT#21745
|
||
$duration = $this->duration; | ||
|
||
if ($userSessionSubscription) { |
There was a problem hiding this comment.
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(); |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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
Code Climate has analyzed commit 9fd6aeb and detected 43 issues on this pull request. Here's the issue category breakdown:
View more on Code Climate. |
According to session visibility by the user and considering sessions with access with a duration time
Refs BT#21745 #5560