|
@@ -12,6 +12,7 @@ import HeaderButton from "../../components/HeaderButton";
|
12
|
12
|
import ProxiwashListItem from "../../components/ProxiwashListItem";
|
13
|
13
|
import ProxiwashConstants from "../../constants/ProxiwashConstants";
|
14
|
14
|
import CustomModal from "../../components/CustomModal";
|
|
15
|
+import AprilFoolsManager from "../../utils/AprilFoolsManager";
|
15
|
16
|
|
16
|
17
|
const DATA_URL = "https://etud.insa-toulouse.fr/~amicale_app/washinsa/washinsa.json";
|
17
|
18
|
|
|
@@ -229,19 +230,26 @@ class ProxiwashScreen extends React.Component<Props, State> {
|
229
|
230
|
}
|
230
|
231
|
|
231
|
232
|
createDataset(fetchedData: Object) {
|
|
233
|
+ let data = fetchedData;
|
|
234
|
+ if (AprilFoolsManager.getInstance().isAprilFoolsEnabled()) {
|
|
235
|
+ data = JSON.parse(JSON.stringify(fetchedData)); // Deep copy
|
|
236
|
+ AprilFoolsManager.getNewProxiwashDryerOrderedList(data.dryers);
|
|
237
|
+ AprilFoolsManager.getNewProxiwashWasherOrderedList(data.washers);
|
|
238
|
+ }
|
232
|
239
|
this.fetchedData = fetchedData;
|
|
240
|
+
|
233
|
241
|
return [
|
234
|
242
|
{
|
235
|
243
|
title: i18n.t('proxiwashScreen.dryers'),
|
236
|
244
|
icon: 'tumble-dryer',
|
237
|
|
- data: fetchedData.dryers === undefined ? [] : fetchedData.dryers,
|
|
245
|
+ data: data.dryers === undefined ? [] : data.dryers,
|
238
|
246
|
extraData: this.state,
|
239
|
247
|
keyExtractor: this.getDryersKeyExtractor
|
240
|
248
|
},
|
241
|
249
|
{
|
242
|
250
|
title: i18n.t('proxiwashScreen.washers'),
|
243
|
251
|
icon: 'washing-machine',
|
244
|
|
- data: fetchedData.washers === undefined ? [] : fetchedData.washers,
|
|
252
|
+ data: data.washers === undefined ? [] : data.washers,
|
245
|
253
|
extraData: this.state,
|
246
|
254
|
keyExtractor: this.getWashersKeyExtractor
|
247
|
255
|
},
|
|
@@ -387,7 +395,12 @@ class ProxiwashScreen extends React.Component<Props, State> {
|
387
|
395
|
*/
|
388
|
396
|
getRenderItem({item, section}: Object) {
|
389
|
397
|
const isMachineRunning = ProxiwashConstants.machineStates[item.state] === ProxiwashConstants.machineStates["EN COURS"];
|
390
|
|
- const machineName = (section.title === i18n.t('proxiwashScreen.dryers') ? i18n.t('proxiwashScreen.dryer') : i18n.t('proxiwashScreen.washer')) + ' n°' + item.number;
|
|
398
|
+ let displayNumber = item.number;
|
|
399
|
+ if (AprilFoolsManager.getInstance().isAprilFoolsEnabled())
|
|
400
|
+ displayNumber = AprilFoolsManager.getProxiwashMachineDisplayNumber(parseInt(item.number));
|
|
401
|
+ const machineName = (section.title === i18n.t('proxiwashScreen.dryers') ?
|
|
402
|
+ i18n.t('proxiwashScreen.dryer') :
|
|
403
|
+ i18n.t('proxiwashScreen.washer')) + ' n°' + displayNumber;
|
391
|
404
|
const isDryer = section.title === i18n.t('proxiwashScreen.dryers');
|
392
|
405
|
const onPress = this.showModal.bind(this, machineName, item, isDryer);
|
393
|
406
|
let width = item.donePercent !== '' ? (parseInt(item.donePercent)).toString() + '%' : 0;
|