Skip to content

Commit

Permalink
Merge pull request #7 from uriweb/v1.1
Browse files Browse the repository at this point in the history
Release 1.1
  • Loading branch information
bjcfuller authored Dec 14, 2022
2 parents ce1c76e + cad045a commit 0ee7bd9
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 6 deletions.
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

A tool that makes it easy to embed dynamic course data from Kuali.

## What's new in v1.1

- Provides a default API url in the event that one is not supplied in the network settings
- Limits pulled courses to ones with active status
- Fixes an issue that caused the cache recency to not be honored

## Example Usage

``[courses subject="COM"]``
Expand All @@ -12,6 +18,6 @@ __Contributors:__ [bjcfuller](https://github.com/bjcfuller), [alexandragauss](ht
__Tags:__ plugins, shortcodes
__Requires at least:__ 5.0
__Tested up to:__ 6.0.2
__Stable tag:__ 1.0
__Stable tag:__ 1.1
__License:__ GPL-3.0
__Licence URI:__ https://www.gnu.org/licenses/gpl-3.0.html
4 changes: 2 additions & 2 deletions inc/uri-kuali-api.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,13 +122,13 @@ function uri_kuali_api_get_courses( $id, $atts ) {

/* Build URL for a list of courses if a course number isn't specified */
if (null === $atts['number']) {
$url = $api_base . '/cm/courses/queryAll?subjectCode=' . $id . '&sort=number&limit=' . $atts['limit'];
$url = $api_base . '/cm/courses/queryAll?subjectCode=' . $id . '&sort=number&limit=' . $atts['limit'] . '&status=active';
return uri_kuali_get_data( $url );
}

/* If a course number is specified, build URL for single course */
else {
$url = $api_base . '/cm/courses/queryAll?subjectCode=' . $id . '&number=' . $atts['number'];
$url = $api_base . '/cm/courses/queryAll?subjectCode=' . $id . '&number=' . $atts['number'] . '&status=active';
return uri_kuali_get_data( $url );
}
}
7 changes: 5 additions & 2 deletions inc/uri-kuali-helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ function uri_kuali_render_course_list( $courses, $attributes ) {
print $attributes['before'];

foreach( $courses as $course ) {
include $template;
//var_dump($course);
//if ( null === $course->dateStart || 'online' == $course->teachingMethod ) {
include $template;
//}
}

print $attributes['after'];
Expand Down Expand Up @@ -80,7 +83,7 @@ function uri_kuali_hash_string ( $string ) {
*/
function uri_kuali_cache_is_expired( $date ) {

$recency = get_option( 'uri_kuali_recency', '1 day' );
$recency = get_site_option( 'uri_kuali_recency', '1 day' );
$expiry = strtotime( '-' . $recency, strtotime('now') );

return ( $date < $expiry );
Expand Down
2 changes: 1 addition & 1 deletion uri-kuali.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Plugin Name: URI Kuali
Plugin URI: https://www.uri.edu
Description: Implements a shortcode to display course data from Kuali's API. [courses subject="AAF"]
Version: 1.0
Version: 1.1
Author: Brandon Fuller
Author: Alexandra Gauss
Author URI:
Expand Down

0 comments on commit 0ee7bd9

Please sign in to comment.