ccs-digitalmarketplace-frameworks 3.4.0 → 3.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -245,3 +245,10 @@
245
245
  editable: False
246
246
  questions:
247
247
  - multiqTradeOrIndustryBodies
248
+
249
+ - name: Virtual user research studio - Booking
250
+ editable: False
251
+ questions:
252
+ - virtualMinimumStudioTime
253
+ - virtualStudioBookingCost
254
+ - virtualMinimumLeadTime
@@ -273,3 +273,10 @@
273
273
  editable: True
274
274
  questions:
275
275
  - multiqTradeOrIndustryBodies
276
+
277
+ - name: Virtual user research studio - Booking
278
+ editable: True
279
+ questions:
280
+ - virtualMinimumStudioTime
281
+ - virtualStudioBookingCost
282
+ - virtualMinimumLeadTime
@@ -317,3 +317,10 @@
317
317
  editable: True
318
318
  questions:
319
319
  - multiqTradeOrIndustryBodies
320
+
321
+ - name: Virtual user research studio - Booking
322
+ editable: True
323
+ questions:
324
+ - virtualMinimumStudioTime
325
+ - virtualStudioBookingCost
326
+ - virtualMinimumLeadTime
@@ -0,0 +1,29 @@
1
+ name: Minimum lead time you need to make a studio booking
2
+ question: What is the minimum lead time you need to make a studio booking?
3
+
4
+ depends:
5
+ - "on": lot
6
+ being:
7
+ - user-research-studios-and-participants
8
+
9
+ type: radios
10
+
11
+ options:
12
+ - label: "1 day"
13
+ - label: "2 days"
14
+ - label: "3 to 5 days"
15
+ - label: "1 week"
16
+ - label: "2 weeks"
17
+ - label: "3 weeks"
18
+ - label: "1 month"
19
+ - label: "6 weeks"
20
+ - label: "More than 6 weeks"
21
+
22
+ depends_on_follow_up:
23
+ whatTypesOfUserResearchStudio:
24
+ - virtual-studio
25
+
26
+ validations:
27
+ -
28
+ name: answer_required
29
+ message: Select the minimum lead time you need to make a studio booking
@@ -0,0 +1,28 @@
1
+ name: Minimum amount of time a studio can be booked for
2
+ question: What is the minimum amount of time a studio can be booked for?
3
+
4
+ depends:
5
+ - "on": lot
6
+ being:
7
+ - user-research-studios-and-participants
8
+
9
+ type: radios
10
+
11
+ options:
12
+ - label: "1 hour"
13
+ - label: "2 hours"
14
+ - label: "3 hours"
15
+ - label: "4 hours"
16
+ - label: "5 hours"
17
+ - label: "6 hours"
18
+ - label: "7 hours"
19
+ - label: "8 hours"
20
+
21
+ depends_on_follow_up:
22
+ whatTypesOfUserResearchStudio:
23
+ - virtual-studio
24
+
25
+ validations:
26
+ -
27
+ name: answer_required
28
+ message: Select the minimum amount of time a studio can be booked for
@@ -0,0 +1,37 @@
1
+ name: Cost of booking a studio
2
+ question: How much does it cost (excluding VAT) to book a studio?
3
+
4
+ depends:
5
+ - "on": lot
6
+ being:
7
+ - user-research-studios-and-participants
8
+
9
+ type: pricing
10
+ fields:
11
+ price: virtualStudioBookingCostPrice
12
+ price_unit: virtualStudioBookingCostUnit
13
+
14
+ units:
15
+ - label: an hour
16
+ value: Hour
17
+ - label: a half day
18
+ value: Half day
19
+ - label: a day
20
+ value: Day
21
+ - label: a week
22
+ value: Week
23
+
24
+ depends_on_follow_up:
25
+ whatTypesOfUserResearchStudio:
26
+ - virtual-studio
27
+
28
+ validations:
29
+ - name: answer_required
30
+ field: virtualStudioBookingCostPrice
31
+ message: Enter how much it costs to book a studio
32
+ - name: not_money_format
33
+ field: virtualStudioBookingCostPrice
34
+ message: Price must be a number, without units, eg 99.95
35
+ - name: answer_required
36
+ field: virtualStudioBookingCostUnit
37
+ message: You must select the unit
@@ -21,6 +21,14 @@ depends_on_follow_up:
21
21
  dependent_follow_up:
22
22
  tradeOrIndustryBodies:
23
23
  - virtual-studio
24
+ virtualMinimumStudioTime:
25
+ - virtual-studio
26
+ virtualStudioBookingCostPrice:
27
+ - virtual-studio
28
+ virtualStudioBookingCostUnit:
29
+ - virtual-studio
30
+ virtualMinimumLeadTime:
31
+ - virtual-studio
24
32
 
25
33
  dependent_follow_up_followup:
26
34
  tradeOrIndustryBodiesOther:
@@ -35,6 +35,14 @@ dependent_follow_up:
35
35
  - user-research-studios
36
36
  tradeOrIndustryBodies:
37
37
  - user-research-studios
38
+ virtualMinimumStudioTime:
39
+ - user-research-studios
40
+ virtualStudioBookingCostPrice:
41
+ - user-research-studios
42
+ virtualStudioBookingCostUnit:
43
+ - user-research-studios
44
+ virtualMinimumLeadTime:
45
+ - user-research-studios
38
46
 
39
47
  dependent_follow_up_followup:
40
48
  otherTradeOrIndustryBodiesOther:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ccs-digitalmarketplace-frameworks",
3
- "version": "3.4.0",
3
+ "version": "3.5.0",
4
4
  "description": "Data files for Digital Marketplace’s procurement frameworks",
5
5
  "repository": "git@github.com:Crown-Commercial-Service/ccs-digitalmarketplace-frameworks",
6
6
  "author": "enquiries@digitalmarketplace.service.gov.uk"
@@ -501,8 +501,10 @@ def pricing_property(question):
501
501
  )
502
502
 
503
503
  if 'price_unit' in question.fields:
504
- pricing[question.fields['price_unit']] = {
505
- "enum": [
504
+ if question.get('units'):
505
+ units = [unit.get('value', unit.get('label')) for unit in question.get('units')]
506
+ else:
507
+ units = [
506
508
  "Unit",
507
509
  "Person",
508
510
  "Licence",
@@ -516,13 +518,18 @@ def pricing_property(question):
516
518
  "Gigabyte",
517
519
  "Terabyte"
518
520
  ]
521
+
522
+ pricing[question.fields['price_unit']] = {
523
+ "enum": units
519
524
  }
520
525
  if 'price_unit' in question.get('optional_fields', []):
521
526
  pricing[question.fields['price_unit']]['enum'].insert(0, "")
522
527
 
523
528
  if 'price_interval' in question.fields:
524
- pricing[question.fields['price_interval']] = {
525
- "enum": [
529
+ if question.get('intervals'):
530
+ intervals = [interval.get('value', interval.get('label')) for interval in question.get('intervals')]
531
+ else:
532
+ intervals = [
526
533
  "Second",
527
534
  "Minute",
528
535
  "Hour",
@@ -533,6 +540,9 @@ def pricing_property(question):
533
540
  "6 months",
534
541
  "Year"
535
542
  ]
543
+
544
+ pricing[question.fields['price_interval']] = {
545
+ "enum": intervals
536
546
  }
537
547
  if 'price_interval' in question.get('optional_fields', []):
538
548
  pricing[question.fields['price_interval']]['enum'].insert(0, "")
@@ -367,6 +367,42 @@
367
367
  "required": [
368
368
  "passIfIn"
369
369
  ]
370
+ },
371
+ "units": {
372
+ "type": "array",
373
+ "items": {
374
+ "type": "object",
375
+ "properties": {
376
+ "label": {
377
+ "type": "string"
378
+ },
379
+ "value": {
380
+ "type": "string"
381
+ }
382
+ },
383
+ "additionalProperties": false,
384
+ "required": [
385
+ "label"
386
+ ]
387
+ }
388
+ },
389
+ "intervals": {
390
+ "type": "array",
391
+ "items": {
392
+ "type": "object",
393
+ "properties": {
394
+ "label": {
395
+ "type": "string"
396
+ },
397
+ "value": {
398
+ "type": "string"
399
+ }
400
+ },
401
+ "additionalProperties": false,
402
+ "required": [
403
+ "label"
404
+ ]
405
+ }
370
406
  }
371
407
  },
372
408
  "additionalProperties": false,
@@ -558,8 +558,31 @@ def test_pricing_property_price_unit_and_interval():
558
558
  }
559
559
  cq = ContentQuestion(manifest)
560
560
  result = pricing_property(cq)
561
- assert isinstance(result['priceInterval']['enum'], list)
562
- assert isinstance(result['priceUnit']['enum'], list)
561
+ assert result['priceUnit']['enum'] == [
562
+ "Unit",
563
+ "Person",
564
+ "Licence",
565
+ "User",
566
+ "Device",
567
+ "Instance",
568
+ "Server",
569
+ "Virtual machine",
570
+ "Transaction",
571
+ "Megabyte",
572
+ "Gigabyte",
573
+ "Terabyte"
574
+ ]
575
+ assert result['priceInterval']['enum'] == [
576
+ "Second",
577
+ "Minute",
578
+ "Hour",
579
+ "Day",
580
+ "Week",
581
+ "Month",
582
+ "Quarter",
583
+ "6 months",
584
+ "Year"
585
+ ]
563
586
 
564
587
 
565
588
  def test_pricing_property_price_unit_and_interval_optional():
@@ -633,6 +656,80 @@ def test_pricing_property_digit_limits_decimal_place_restriction():
633
656
  assert '{1,14}' in result['priceMax']['pattern']
634
657
 
635
658
 
659
+ def test_pricing_property_price():
660
+ manifest = {
661
+ "id": "Test",
662
+ "type": "pricing",
663
+ "fields": {
664
+ "price": "price"
665
+ }
666
+ }
667
+ cq = ContentQuestion(manifest)
668
+ result = pricing_property(cq)
669
+ assert not result['price']['pattern'].startswith("^$|")
670
+
671
+
672
+ def test_pricing_property_custom_units():
673
+ manifest = {
674
+ "id": "Test",
675
+ "type": "pricing",
676
+ "fields": {
677
+ "price": "price",
678
+ "price_unit": "priceUnit"
679
+ },
680
+ "units": [
681
+ {
682
+ "label": "Option 1"
683
+ },
684
+ {
685
+ "label": "Option 2",
686
+ "value": "option-2"
687
+ },
688
+ {
689
+ "label": "Option 3",
690
+ "value": "option-3"
691
+ }
692
+ ]
693
+ }
694
+ cq = ContentQuestion(manifest)
695
+ result = pricing_property(cq)
696
+ assert result['priceUnit']['enum'] == [
697
+ "Option 1",
698
+ "option-2",
699
+ "option-3"
700
+ ]
701
+
702
+
703
+ def test_pricing_property_custom_intervals():
704
+ manifest = {
705
+ "id": "Test",
706
+ "type": "pricing",
707
+ "fields": {
708
+ "price": "price",
709
+ "price_interval": "priceInterval"
710
+ },
711
+ "intervals": [
712
+ {
713
+ "label": "Option 1",
714
+ "value": "option-1"
715
+ },
716
+ {
717
+ "label": "Option 2"
718
+ },
719
+ {
720
+ "label": "Option 3"
721
+ }
722
+ ]
723
+ }
724
+ cq = ContentQuestion(manifest)
725
+ result = pricing_property(cq)
726
+ assert result['priceInterval']['enum'] == [
727
+ "option-1",
728
+ "Option 2",
729
+ "Option 3"
730
+ ]
731
+
732
+
636
733
  @given(st.text())
637
734
  def test_number_property(id):
638
735
  actual = number_property({'id': id, 'type': 'number'})