EASOL / easol

EASOL - A New Way to Open Learning with Ed-Tech
http://easol.org
GNU Affero General Public License v3.0
1 stars 4 forks source link

Add system variables #339

Closed regiscamimura closed 8 years ago

regiscamimura commented 8 years ago

Create system variables for school year, StaffUSI, and term

regiscamimura commented 8 years ago

@edgarf Just added system variables for:

I would use an underline to have the system variable to be named as $CURRENT_SCHOOL_YEAR, but I didn't to match the current configuration option name. Is that ok?

Also, note the $CURRENT_TERMID is an ID, a number, NOT a textual value. Is that ok?

edgarf commented 8 years ago

Hi Regis,

Thanks a lot! Good on both

Edgar

On 29 Apr 2016, at 23:29, Regis Camimura notifications@github.com wrote:

@edgarf Just added system variables for:

$StaffUSI $CURRENT_SCHOOLYEAR $CURRENT_TERMID I would use an underline to have the system variable to be named as $CURRENT_SCHOOL_YEAR, but I didn't to match the current configuration option name. Is that ok?

Also, note the $CURRENT_TERMID is an ID, a number, NOT a textual value. Is that ok?

— You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub

edgarf commented 8 years ago

@regiscamimura, just one question - can we use these variables in command text?

regiscamimura commented 8 years ago

@edgarf It can be used in the command text, but with some rules. From what we did for #273 , to use it in the command text, we need to:

  1. Create a filter to hold the $StaffUSI as default value. For example:
- Display Name: StaffUSI
- Field Name: StaffUSI
- Type: system variable
- Values: [can be blank]
- Default: $StaffUSI
  1. Then you can use it in the command text with this syntax: SELECT * FROM Staff WHERE Staff.StaffUSI = $filter.StaffUSI

Note the $filter.StaffUSI usage. We create a map between $filter.StaffUSI and the system variable $StaffUSI through the filter. Specially, the "Field Name". If we set "Field Name" to be "LoggedUser", we would need to do in the command text: SELECT * FROM Staff WHERE Staff.StaffUSI = $filter.LoggedUser

We can improve things here a bit and avoid the need of a filter, so we could do something like SELECT * FROM Staff WHERE Staff.StaffUSI = $StaffUSI

So system variables gets automatically replaced with the proper value, no need to map using the filters. Estimate for that is 3h.

edgarf commented 8 years ago

@regiscamimura this way is good enough, thank you!