Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Stud.IP
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Marcus Eibrink-Lunzenauer
Stud.IP
Commits
038a5bdc
Commit
038a5bdc
authored
1 year ago
by
Elmar Ludwig
Browse files
Options
Downloads
Patches
Plain Diff
start counting weeks from the current week of `vorles_beginn`, fixes #2608
Closes #2608 Merge request
studip/studip!2151
parent
2ae8194d
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/models/Semester.class.php
+1
-14
1 addition, 14 deletions
lib/models/Semester.class.php
lib/raumzeit/MetaDate.class.php
+3
-14
3 additions, 14 deletions
lib/raumzeit/MetaDate.class.php
with
4 additions
and
28 deletions
lib/models/Semester.class.php
+
1
−
14
View file @
038a5bdc
...
...
@@ -410,20 +410,7 @@ class Semester extends SimpleORMap
*/
public
function
getCorrectedLectureBegin
()
{
$dow
=
(
int
)
date
(
'w'
,
$this
->
vorles_beginn
);
// Date is already on a monday
if
(
$dow
===
1
)
{
return
$this
->
vorles_beginn
;
}
// Saturday or sunday: return next monday
if
(
$dow
===
0
||
$dow
===
6
)
{
return
strtotime
(
'next monday'
,
$this
->
vorles_beginn
);
}
// Otherwise return last monday
return
strtotime
(
'last monday'
,
$this
->
vorles_beginn
);
return
strtotime
(
'this week monday'
,
$this
->
vorles_beginn
);
}
...
...
This diff is collapsed.
Click to expand it.
lib/raumzeit/MetaDate.class.php
+
3
−
14
View file @
038a5bdc
...
...
@@ -550,18 +550,7 @@ class MetaDate
$passed
=
true
;
}
if
(
$passed
&&
(
$sem_end
>=
$val
[
'vorles_ende'
])
&&
(
$startAfterTimeStamp
<=
$val
[
'ende'
]))
{
// correction calculation, if the semester does not start on monday
$dow
=
(
int
)
date
(
'w'
,
$val
[
'vorles_beginn'
]);
if
(
$dow
===
0
)
{
$corr
=
1
;
}
elseif
(
$dow
<=
5
)
{
$corr
=
(
$dow
-
1
)
*
-
1
;
}
elseif
(
$dow
==
6
)
{
$corr
=
2
;
}
else
{
$corr
=
0
;
}
$ret
[
$val
[
'semester_id'
]]
=
$this
->
getVirtualSingleDatesForSemester
(
$metadate_id
,
$val
[
'vorles_beginn'
],
$val
[
'vorles_ende'
],
$startAfterTimeStamp
,
$corr
);
$ret
[
$val
[
'semester_id'
]]
=
$this
->
getVirtualSingleDatesForSemester
(
$metadate_id
,
$val
[
'vorles_beginn'
],
$val
[
'vorles_ende'
],
$startAfterTimeStamp
);
}
}
...
...
@@ -575,10 +564,10 @@ class MetaDate
* @param int timestamp of semester start
* @param int timestamp of semester end
* @param int alternative timestamp to start from
* @param int correction calculation
, if the semester does not start on monday (number of days?
)
* @param int correction calculation
(obsolete
)
* @return array returns an array of two arrays of SingleDate objects: 'dates' => all new and surviving dates, 'dates_to_delete' => obsolete dates
*/
function
getVirtualSingleDatesForSemester
(
$metadate_id
,
$sem_begin
,
$sem_end
,
$startAfterTimeStamp
,
$corr
)
function
getVirtualSingleDatesForSemester
(
$metadate_id
,
$sem_begin
,
$sem_end
,
$startAfterTimeStamp
,
$corr
=
0
)
{
$dates
=
[];
$dates_to_delete
=
[];
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment